Callback namespace for remote functions.
Platform Support
Jaxer Server Framework | Jaxer Client Framework | no | 1.0 |
---|
Properties
![]() |
|||
Property | Action | Jaxer Server Framework | Jaxer Client Framework |
---|---|---|---|
The default polling interval used to see whether the XMLHttpRequest for an async callback function call has returned. Initially
set to 11.
(Advanced) |
No Details | no | 1.0 |
|
|||
The default HTTP method to use for callback function requests. Initially set to "POST".
|
No Details | no | 1.0 |
|
|||
The default number of milliseconds to wait before timing out an async callback function request. Initially set to 10 * 1000
(10 seconds).
|
No Details | no | 1.0 |
|
Functions
![]() |
||||||||||||||
Method | Action | Jaxer Server Framework | Jaxer Client Framework | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
static getBaseUrl() : String
Returns the URL for use in callbacks, without any parameters
(Advanced) |
Show Details | no | 1.0 | |||||||||||
Returns
|
||||||||||||||
static onfailureAsync(Object error, Object extra, XMLHttpRequest xhr) :
void
The default method used to handle errors when calling remote functions asynchronously. It alerts the error message if Jaxer.ALERT_CALLBACK_ERRORS
is true, and in any case throws an error
(Advanced) |
Show Details | no | 1.0 | |||||||||||
Parameters
|
||||||||||||||
static ontimeoutAsync(Error error, Object extra, XMLHttpRequest xhr) :
void
The default method used to handle timeouts when calling remote functions asynchronously. It alerts the error message if Jaxer.ALERT_CALLBACK_ERRORS
is true, and in any case throws an error
(Advanced) |
Show Details | no | 1.0 | |||||||||||
Parameters
|
||||||||||||||
static processReturnValue(String functionName, String rawResult) : Object
Transforms the raw result data from the XHR call into the expected data format.
(Advanced) |
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static createQuery(String functionName, Object args, [Number initialNumberToSkip]) : String
Creates a query string for calling a remote function with the given arguments
|
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static formUrlEncode(String str) : String
URL Encode a query string.
|
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static getQueryParts(Object functionToCall, Object paramsToPass, String ...) : Object
Returns a hash of the "form-like" name-value pairs needed to call a JavaScript function on the server. These can be submitted
to the server as a GET request (but see Callback.getUrl which wraps this in a Url for you) or as a POST request, and usually
via an XMLHttpRequest mechanism.
The server listens for two special name-value pairs: "resultAs" and "paramsAs". If present, resultAs specifies how the result of functionToCall is to be returned to the client. Valid values for resultAs are "text", "object", and "wrappedObject" (default), which return the result of the callback as a single string, a JSON object literal, or a JSON object literal with metadata, respectively. If present, "paramsAs" specifies how the request is to be translated into arguments for the functionToCall. Valid values for "paramsAs" are "text", "object", and "default", which hands the GET or POST data to functionToCall as a single string, a single hash (object literal) of name-value pairs, or as regular JavaScript arguments with values extracted from paramsToPass, respectively. |
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static getUrl(Object functionToCall, Object paramsToPass, String ...) : String
Returns the URL that can be used as a GET request to call a JavaScript function on the server.
The server listens for two special properties: "resultAs" and "paramsAs". If present, resultAs specifies how the result of functionToCall is to be returned to the client. Valid values for resultAs are "text", "object", and "wrappedObject" (default), which return the result of the callback as a single string, JSON object literal, or JSON object literal with metadata, respectively. If present, "paramsAs" specifies how the request is to be translated into arguments for the functionToCall. Valid values for "paramsAs" are "text", "object", and "default", which hands the GET or POST data to functionToCall as a single string, a single hash (object literal) of name-value pairs, or as regular JavaScript arguments with values extracted from paramsToPass, respectively. |
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static hashToQuery(Object hash) : String
Converts a javascript object (hash) into a http query string.
|
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static invokeFunction(String functionName, Object args) : Object
This method invokes a synchronous call to a proxied JavaScript function on the server from the client side javascript.
|
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|
||||||||||||||
static invokeFunctionAsync(Object callback, String functionName, Object args) :
void
This method invokes an asynchronous call to a proxied javascript function on the server from the client side javascript. A
callback function needs to be provided and is called once the XHR request completes or times out.
|
Show Details | no | 1.0 | |||||||||||
Parameters
|
||||||||||||||
static remote(String functionName, Object args, [Object callback]) : Object
A short convenience function to call a remote function, synchronously or asynchronously based on whether or not you specify
a callback function as the third argument.
|
Show Details | no | 1.0 | |||||||||||
Parameters
Returns
|