jsUtils

utils  0.2.4

jsUtils > utils > Utils.http
Search:
 
Filters

static Class Utils.http

The main jsUtils http helpers namespace.

Methods

createXMLHttpRequst

XMLHttpRequest createXMLHttpRequst ( )
A low-level utility method for obtaining a new XMLHttpRequest in a cross-browser manner.
Returns: XMLHttpRequest
an implementation of XMLHttpRequest

get

void get ( uri , callback , errback )
A simple method for performing an asynchonous GET request via xhr
Parameters:
uri <String> the uri to retrieve
callback <Function> the function to call when the data is available, the function will be called with xhr object as its first argument.
errback <Function> the function to call an error occurs or the request.status != 200, the function will be called with xhr object as its first argument.
Returns: void

scriptRequest

void scriptRequest ( uri , jsonp , callback , errback , timeout )
A simple method for performing an asynchonous jsonp GET request via the script tag. This can be used for loading data cross-domain. The data provider must support json requests.
Parameters:
uri <String> the uri to retrieve
jsonp <String> the request-parameter to use to provide the jsonp callback to the service
callback <Function> the function to call when the data is available, the function will be called with the deserialized json as its first argument.
errback <Function> the function to call when an error occurs
timeout <object> an optional time before the scriptRequest gives up and calls the errback.
Returns: void


Copyright © 2009 Gareth Andrew. All rights reserved.