Class Index | File Index

Classes


Namespace jsf.ajax

The namespace for Ajax functionality.
Defined in: jsf.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
The namespace for Ajax functionality.
Method Summary
Method Attributes Method Name and Description
<static>  
jsf.ajax.addOnError(callback)
Register a callback for error handling.
<static>  
jsf.ajax.addOnEvent(callback)
Register a callback for event handling.
<static>  
jsf.ajax.request(source, event, options)

Send an asynchronous Ajax request to the server.

<static>  
jsf.ajax.response(request, context)

Receive an Ajax response from the server.

Namespace Detail
jsf.ajax
The namespace for Ajax functionality.
Method Detail
<static> jsf.ajax.addOnError(callback)
Register a callback for error handling.

Usage:


jsf.ajax.addOnError(handleError);
...
var handleError = function handleError(data) {
...
}

Implementation Requirements:

This function must accept a reference to an existing JavaScript function. The JavaScript function reference must be added to a list of callbacks, making it possible to register more than one callback by invoking jsf.ajax.addOnError more than once. This function must throw an error if the callback argument is not a function.
Parameters:
callback
a reference to a function to call on an error

<static> jsf.ajax.addOnEvent(callback)
Register a callback for event handling.

Usage:


jsf.ajax.addOnEvent(statusUpdate);
...
var statusUpdate = function statusUpdate(data) {
...
}

Implementation Requirements:

This function must accept a reference to an existing JavaScript function. The JavaScript function reference must be added to a list of callbacks, making it possible to register more than one callback by invoking jsf.ajax.addOnEvent more than once. This function must throw an error if the callback argument is not a function.
Parameters:
callback
a reference to a function to call on an event

<static> jsf.ajax.request(source, event, options)

Send an asynchronous Ajax request to the server.

Usage:


Example showing all optional arguments:

<commandButton id="button1" value="submit"
    onclick="jsf.ajax.request(this,event,
      {execute:'button1',render:'status',onevent: handleEvent,onerror: handleError});return false;"/>
</commandButton/>

Implementation Requirements:

This function must: Form serialization should occur just before the request is sent to minimize the amount of time between the creation of the serialized form data and the sending of the serialized form data (in the case of long requests in the queue). Before the request is sent it must be put into a queue to ensure requests are sent in the same order as when they were initiated. The request callback function must examine the queue and determine the next request to be sent. The behavior of the request callback function must be as follows:

Parameters:
source
The DOM element that triggered this Ajax request, or an id string of the element to use as the triggering element.
event
The DOM event that triggered this Ajax request. The event argument is optional.
options
The set of available options that can be sent as request parameters to control client and/or server side request processing. Acceptable name/value pair options are:
name value
execute space seperated list of client identifiers
render space seperated list of client identifiers
onevent function to callback for event
onerror function to callback for error
params object containing parameters to include in the request
The options argument is optional.
Throws:
Error if first required argument element is not specified

<static> jsf.ajax.response(request, context)

Receive an Ajax response from the server.

Usage:


jsf.ajax.response(request, context);

Implementation Requirements:

This function must evaluate the markup returned in the request.responseXML object and perform the following action:

Parameters:
request
The XMLHttpRequest instance that contains the status code and response message from the server.
context
An object containing the request context, including the following properties: the source element, per call onerror callback function, and per call onevent callback function.
Throws:
Error if request contains no data

Documentation generated by JsDoc Toolkit 2.0.2 on Tue Mar 01 2011 16:13:14 GMT-0500 (EST)