ajax2.js

Provides basic Asynchronous XML (AJAX) routines. (also see soap.js for simplified SOAP routines.)

THIS IS THE NEW API VERSION. YOU CAN STILL USE THE OLD ONE ( ajax.js ), BUT IT IS OBSOLETE AND UNSUPPORTED. YOU SHOULD SWITCH TO THIS INTERFACE ASAP.

Functions

OAT.AJAX.[METHOD](url, data, callback, options)

Sends an HTTP request to a pageurl. Valid METHOD names are:

OAT.AJAX.abortAll()

Cancels all pending requests.

Properties

OAT.AJAX.startRef

Function to be executed when a request is being sent.

OAT.AJAX.endRef

Function to be executed when all requests are satisfied (or canceled).

Constants

OAT.AJAX.AUTH_NONE

When auth option of request is set to this constant, no authentication will be performed.

OAT.AJAX.AUTH_BASIC

When auth option of request is set to this constant, request header with authentication data will be appended using auth basic scheme (as described in rfc2617 ).

OAT.AJAX.AUTH_DIGEST

Auth digest scheme is not yet supported.

OAT.AJAX.TYPE_TEXT

When type option of request is set to this value, request will be returned as plain text.

OAT.AJAX.TYPE_XML

When type option of request is set to this value, request will be returned as XML document.

Messages

OAT.MSG.AJAX_START

When AJAX request is sent, OAT emits this message containing URL of the request and appropriate message code.

OAT.MSG.AJAX_ERROR

When AJAX request is unsuccessful, OAT emits this message containing request object and appropriate message code.

Example


var options = {
        user:"username",
        password:"top_secret",
        auth:OAT.AJAX.AUTH_BASIC,
        onerror:function(request) { alert(request.getStatus()); }
}
var callback = function(data) { alert(data); };
OAT.AJAX.GET("/myfile.xml", false, callback, options);

CategoryDocumentation CategoryOAT CategoryOpenSource