Ajax

Ajax class performs asynchronous HTTP request.

new Ajax()

Creats an Ajax object

Methods

addEventListener(type, callback)

Registers an event listener object to EventDispatcher object so that the listener receives the notification.

Parameters:
Name Type Description
type String The type of event.
callback Function The listener function.

dispatchEvent(Event)

Dispatches an event to the event flow.

Parameters:
Name Type Description
Event arc.Event object

getResponseJSON() → {Object}

Returns response in JSON object.

Returns:
Object JSON Object

getResponseText() → {String}

Returns responseText

Returns:
String A reponseText of XHR object

getURL() → {String}

Retuns the URL

Returns:
String URL

load(url, params)

Sends a HTTP request asynchronously. A COMPLETE event will be dispatched when it gets the the response.

Parameters:
Name Type Description
url String A URL that is send the request to.
params Object Parameters

removeEventListener(type, callback)

Removes a listener from the EventDispatcher object.

Parameters:
Name Type Description
type String The type of event.
callback Function The listener function.

setMethod(method)

Set the HTTP method.

Parameters:
Name Type Description
method String HTTP method