DLSupport.AJAX

Send and retrieve information without reloading page.

This is used when we cannot use Prototype.

Summary
DLSupport.AJAXSend and retrieve information without reloading page.
Functions
monitorMonitor the states of the AJAX object and call the appropriate callback functions.
requestMake a request to the given url using the given method and parameters.

Functions

monitor

monitor: function(ajax,
error,
failure,
success)

Monitor the states of the AJAX object and call the appropriate callback functions.

Parameters

ajax(object) The AJAX transport.
error(function) The function to call if there was an error while the request is being made.
failure(function) The function to call if the request was a failure.
success(function) The function to call if the request was a success.

request

request: function(url)

Make a request to the given url using the given method and parameters.

Parameters

url(string) The URL of the page to request.
options(object) An object containing various options used by this method.  Defaults to an empty object

The structure of the options parameter, if given, should look like the following:

Object(
    method: {
        (string) The method to use to make the request. This should
        be either "GET" or "POST". Defaults to "POST".
    },
    onError: {
        (function) The callback function to call if at any time an
        error occurred in the request. Defaults to a function that
        alerts the user that an error has occurred.
    },
    onFailure: {
        (function) The callback function for a request that has
        failed. Defaults to an empty function.
    },
    onSuccess: {
        (function) The callback function for a successful request.
        Defaults to an empty function.
    },
    parameters: {
        (object) An object containing any information to be sent to
        the requested URL. Defaults to an empty object.
    },
    query_string: {
        (string) If given, this will be used instead of the
        "parameters" option. This should be a properly formed query
        string to be sent to the server. Defaults to an empty
        string.
    }
)

Returns

(mixed) The AJAX transport.  This can be eitehr XMLHttpRequest or ActiveXObject, depending on the browser.

monitor: function(ajax,
error,
failure,
success)
Monitor the states of the AJAX object and call the appropriate callback functions.
request: function(url)
Make a request to the given url using the given method and parameters.