Client side code: Javascript API

JavAjax uses a javascript object to perform some activities, such error field highlighting or message/error reporting. This javascript object, Javajax, can be useful at application level as well.
Client side code: Javascript Action Interface
JavAjax offers a simple and safe way to call your action methods: Javascript Action Interface. Basically you can obtain the Action interface importing a generated javascript file, requested through the URL [Action Class|Binding].[javascript extension].
By default, javascript extension is "ajs", or you can specify one in the filter configuration.
Please note that if the URLBinding contains a path, it must be specified when requesting the ajs file. Moreover, the relative javascript object name will be built adding the path to the Action className, in java syntax (i.e. action bound to "admin/Report" will generate the javascript object "AdminReport", and the url to obtain it will be "/admin/Report.ajs")

<script type="text/javascript" src="MyAction.ajs"/>

The obtained file will contain the Action interface, that will give you access to the Action methods, both for ajax and page modes.

Calling the Action in ajax mode
Ajax call is performed through the javascript call MyAction.myMethod.ajax({callParameters}), passing an hash containing specification for the call. Callback functions will receive either Response object or jqXHR object, depending on what js framework you use, prototype.js or jquery.

Available Call Parameters:

Usage:
MyAction.myMethod.ajax(
    parameters:{name:'Banjamin',surname:'Franklin'}
    , method:'GET'
    , onSuccess:function(response|jqXHR) {
        ...
    }
    , onFailure:function(response|jqXHR) {
        ...
    }
    , on404:function(response|jqXHR) {
        ...
    }
);

Calling the Action in page mode
Page mode call is performed through the javascript call MyAction.myMethod.page({callParameters}), passing an hash containing specification for the call.

Available Call Parameters:

Usage:
MyAction.myMethod.page(
    parameters:{name:'Banjamin',surname:'Franklin'}
    , method:'GET'
    , target:'mySecondWindow'
);