OpenWGA 7.4 - JavaScript reference

WGA.ajax
Method :

WGA.ajax.request(method, uri, data, cb [, headers])

On object WGA.ajax
Usage Executes an HTTP request via AJAX
Description

This is a convenience method to execute AJAX requests from clientside JavaScript in a single call. It uses an XMLHTTPRequest object for executing this functionality, which is retrieved in a way depending on the browser type (either the native XMLHTTPRequest of JavaScript or an ActiveX object "XMLHTTP" in IE6).

The call registers a callback function as parameter "cb" which gets called once the response returns with data. This function receives the XMLHTTPRequest object that executed the request as single parameter, so it can read the returned data and react on it.

Parameters

method (String):

The HTTP method to execute, for example "GET" or "POST"

url (String):

The URI to send the request to

data (Object):

Some data to be sent with a POST request. May be any object type supported by the send() method of XMLHTTPRequest as parameter "data". Specify null to not use it.

cb (JavaScript function):

The callback function

headers (JavaScript object, optional):

An object containing properties which will be set as HTTP headers on the request. Property names are used as header names, values as header values.