OpenWGA 7.6 - JavaScript reference

WGA.ajax
Method :

WGA.ajax.action(params)

On object WGA.ajax
Usage Calls a WebTML AJAX action from JavaScript
Description

This function takes a JavaScript object "params" containing several parameters about the called action.

The action link generated by <tml:action ref="actionid"> determines the action to be called and the WebTML action parameters of the call. It must also be generated with AJAX enabled, using the ajax attribute.

Optionally the call can also be provided with URL parameters in the "params" property, which have the advantage over action parameters to be determinable on the client side by the JavaScript itself. All values on this params object will get converted to strings when they are converted to URL parameters. The WebTML action code can retrieve these parameters using method this.request.getParameter(paramName).

Parameters

params (JavaScript object):

An object containing parameters as properties. Valid properties are:

  • action (String): Action link of the called action, generated by <tml:action ref="actionid"/>
  • graydiv (Boolean, optional): Determines if the portlet should be "greyed out" while the action is called
  • callback (JavaScript function, optional): A function called after the AJAX response returns. Gets the XMLHTTPRequest object that was used to execute the AJAX request as single parameter.
  • mode (String, optional): Should be set to "norefresh" if the action called is also of AJAX type "norefresh".
  • params (JavaScript object, optional): An object whose properties are to be used as URL parameters on the action call, using property name as parameter name and property value as parameter value. Specifying multi-value parameters is not supported. Parameter values are automatically encoded in UTF-8, so using this OpenWGA output encoding is strongly encouraged when using this functionality with non-ASCII text values.
Examples

Calling a simple AJAX action. Note the embracing string delimiters around <tml:action>, so the returned action link generated by that tag is given as string to the function:

WGA.ajax.action({

  action: "<tml:action ref="$store" ajax="true"/>",

  graydiv: true

});