Class GSXHR

Implements a cross-browser wrapper around the XMLHttpRequest object.

Class Summary
Constructor Attributes Constructor Name and Description
 
GSXHR(options)
Creates a new GSXHR instance.
Method Summary
Method Attributes Method Name and Description
 
Cancels an in-flight request
 
Returns the response, interpreted according to the Content-Type response header
 
send(url, data)
Sends an HTTP request
Class Detail
GSXHR(options)
Creates a new GSXHR instance.
Parameters:
{Object} options Optional
an object literal specifying options to set:
{Function} options.onSuccess
a callback function to be invoked upon receipt of a success response from the server (status >= 200 and < 300). The first argument to the callback is the server response interpreted based upon the Content-Type response header, the 2nd argument is the raw server response as a String.
{Function} options.onFailure
callback function to be invoked upon receipt of a non-success response from the server. The first argument to the callback is the server response interpreted based upon the Content-Type response header, the 2nd argument is the raw server response as a String.
{boolean} options.autoCancel
if multiple requests are sent through this instance any in-flight request will be canceled prior to sending a new request. Defaults to false.
{String} options.method
the HTTP method to use. Defaults to GET.
{boolean} options.urlEncodeData
if request data is passed to the GSXHR.send() method, and this option is set to true, the data will be URL-encoded prior to being sent to the server. Defaults to true.
{String} options.contentType
the content type of the request data. Defaults to application/x-www-form-urlencoded.
Method Detail
cancel()
Cancels an in-flight request

{mixed} getResponse()
Returns the response, interpreted according to the Content-Type response header
Returns:
{mixed} the interpreted response

send(url, data)
Sends an HTTP request
Parameters:
{String} url
the request URL
{mixed} data
the request data, specified either as key-value pairs passed as an object literal OR as a String

Documentation generated by JsDoc Toolkit 2.3.2 on Wed Mar 07 2012 11:47:30 GMT+1300 (NZDT)