Zimlet JavaScript API Reference - AjxRpcRequest

Class AjxRpcRequest


This class encapsulates the XML HTTP request, hiding differences between browsers. The internal request object depends on the browser. While it is possible to use this class directly, AjxRpc provides a managed interface to this class

Defined in: AjxRpcRequest.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Field Summary
Field Attributes Field Name and Description
 
id
The id for this object.
Method Summary
Method Attributes Method Name and Description
 
Cancels a pending request.
 
invoke(requestStr, serverUrl, requestHeaders, callback, method, timeout)
Sends this request to the target URL.
Class Detail
AjxRpcRequest(id)

Author: Ross Dargahi, Conrad Damon.
Parameters:
{string} id Optional
the ID to identify this object
See:
AjxRpc
Field Detail
id
The id for this object.
Method Detail
cancel()
Cancels a pending request.

{object|hash} invoke(requestStr, serverUrl, requestHeaders, callback, method, timeout)
Sends this request to the target URL. If there is a callback, the request is performed asynchronously.
Parameters:
{string} requestStr Optional
the HTTP request string/document
{string} serverUrl
the request target
{array} requestHeaders Optional
an array of HTTP request headers
{AjxCallback} callback
the callback for asynchronous requests. This callback will be invoked when the requests completes. It will be passed the same values as when this method is invoked synchronously (see the return values below) with the exception that if the call times out (see timeout param below), then the object passed to the callback will be the same as in the error case with the exception that the status will be set to AjxRpcRequest.TIMEDOUT.
{Constant} method Optional
the HTTP method -- GET, POST, PUT, DELETE. if true, use get method for backward compatibility
{number} timeout Optional
the timeout (in milliseconds) after which the request is canceled
Throws:
{AjxException.NETWORK_ERROR}
a network error occurs
{AjxException.UNKNOWN_ERROR}
an unknown error occurs
Returns:
{object|hash} if invoking in asynchronous mode, then it will return the id of the underlying AjxRpcRequest object. Else if invoked synchronously, if there is no error (i.e. we get a HTTP result code of 200 from the server), an object with the following attributes is returned
  • text - the string response text
  • xml - the string response xml
  • success - boolean set to true
If there is an eror, then the following will be returned
  • text - the string response text
  • xml - the string response xml
  • success - boolean set to false
  • status - HTTP status
See:
AjxRpc.invoke

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:30 GMT-0400 (EDT)