Ajax.js

Summary
Ajax.js
Functions
ALKMaps.nullHandler@param {} request
ALKMaps.loadURLBackground load a document.
ALKMaps.parseXMLStringParse XML into a doc structure
ALKMaps.Ajax
Functions
emptyFunction
getTransport{Object} Transport mechanism for whichever browser we’re in, or false if none available.
Properties
activeRequestCount{Integer}
ALKMaps.Ajax.Responders{Object}
Properties
responders{Array}
Functions
register
unregister
dispatch
onCreate
onComplete
ALKMaps.Ajax.Base
Constructor
ALKMaps.Ajax.Base
ALKMaps.Ajax.RequestDeprecated.
Properties
_complete{Boolean}
Constructor
ALKMaps.Ajax.Request
Functions
request
onStateChange
setRequestHeaders
success{Boolean} -
getStatus
respondToReadyState
getHeader
dispatchExceptionIf the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.
Properties
Events{Array(String)}
ALKMaps.Ajax.Response
Properties
status{Integer}
statusText{String}
Constructor
ALKMaps.Ajax.Response
Functions
getStatus
getStatustext
getHeader
getResponseHeader
getElementsByTagNameNS
serializeXMLToStringWrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.

Functions

ALKMaps.nullHandler

ALKMaps.nullHandler = function(request)

@param {} request

ALKMaps.loadURL

ALKMaps.loadURL = function(uri,
params,
caller,
onComplete,
onFailure)

Background load a document.  Deprecated.  Use ALKMaps.Request.GET method instead.

Parameters

uri{String} URI of source doc
params{String} or {Object} GET params.  Either a string in the form “?hello=world&foo=bar” (do not forget the leading question mark) or an object in the form {‘hello’: ‘world’, ‘foo’: ‘bar}
caller{Object} object which gets callbacks
onComplete{Function} Optional callback for success.  The callback will be called with this set to caller and will receive the request object as an argument.  Note that if you do not specify an onComplete function, ALKMaps.nullHandler will be called (which pops up a user friendly error message dialog).
onFailure{Function} Optional callback for failure.  In the event of a failure, the callback will be called with this set to caller and will receive the request object as an argument.  Note that if you do not specify an onComplete function, ALKMaps.nullHandler will be called (which pops up a user friendly error message dialog).

Returns

{<ALKMaps.Request.XMLHttpRequest>} The request object.  To abort loading, call request.abort().

ALKMaps.parseXMLString

ALKMaps.parseXMLString = function(text)

Parse XML into a doc structure

Parameters

text{String}

Returns

{?}  Parsed AJAX Responsev

ALKMaps.Ajax

Summary
Functions
emptyFunction
getTransport{Object} Transport mechanism for whichever browser we’re in, or false if none available.
Properties
activeRequestCount{Integer}

Functions

emptyFunction

emptyFunction: function ()

getTransport

getTransport: function()

Returns

{Object} Transport mechanism for whichever browser we’re in, or false if none available.

Properties

activeRequestCount

{Integer}

Properties

responders

{Array}

Functions

register

register: function(responderToAdd)

Parameters

responderToAdd{?}

unregister

unregister: function(responderToRemove)

Parameters

responderToRemove{?}

dispatch

dispatch: function(callback,
request,
transport)

Parameters

callback{?}
request{?}
transport{?}

onCreate

onCreate: function()

onComplete

onComplete: function()

ALKMaps.Ajax.Base

Constructor

ALKMaps.Ajax.Base

Parameters

options{Object}

ALKMaps.Ajax.Request

Deprecated.  Use ALKMaps.Request method instead.

Inherit

Summary
Properties
_complete{Boolean}
Constructor
ALKMaps.Ajax.Request
Functions
request
onStateChange
setRequestHeaders
success{Boolean} -
getStatus
respondToReadyState
getHeader
dispatchExceptionIf the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.
Properties
Events{Array(String)}

Properties

_complete

{Boolean}

Constructor

ALKMaps.Ajax.Request

Parameters

url{String}
options{Object}

Functions

request

request: function(url)

Parameters

url{String}

onStateChange

onStateChange: function()

setRequestHeaders

setRequestHeaders: function()

success

success: function()

Returns

{Boolean} -

getStatus

getStatus: function()

Returns

{Integer}Status

respondToReadyState

respondToReadyState: function(readyState)

Parameters

readyState{?}

getHeader

getHeader: function(name)

Parameters

name{String} Header name

Returns

{?}response header for the given name

dispatchException

dispatchException: function(exception)

If the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.

If no optional onException function is set, we suspect that the user may have also not used ALKMaps.Ajax.Responders.register to register a listener for the onException call.  To make sure that something gets done with this exception, only dispatch the call if there are listeners.

If you explicitly want to swallow exceptions, set request.options.onException to an empty function (function(){}) or register an empty function with ALKMaps.Ajax.Responders for onException.

Parameters

exception{?}

Properties

Events

{Array(String)}

ALKMaps.Ajax.Response

Properties

status

{Integer}

statusText

{String}

Constructor

ALKMaps.Ajax.Response

Parameters

request{Object}

Functions

getStatus

getStatustext

Returns

{String}statusText

getHeader

getResponseHeader

getResponseHeader: function(name)

Returns

{?}response header for given name

getElementsByTagNameNS

ALKMaps.Ajax.getElementsByTagNameNS = function(parentnode,
nsuri,
nsprefix,
tagname)

Parameters

parentnode{?}
nsuri{?}
nsprefix{?}
tagname{?}

Returns

{?}

serializeXMLToString

ALKMaps.Ajax.serializeXMLToString = function(xmldom)

Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.  We need to come up with a way to serialize in those browser: for now, these browsers will just fail.  #535, #536

Parameters

xmldom {XMLNode} xml dom to serialize

Returns

{?}

ALKMaps.nullHandler = function(request)
@param {} request
ALKMaps.loadURL = function(uri,
params,
caller,
onComplete,
onFailure)
Background load a document.
ALKMaps.parseXMLString = function(text)
Parse XML into a doc structure
emptyFunction: function ()
getTransport: function()
{Object} Transport mechanism for whichever browser we’re in, or false if none available.
register: function(responderToAdd)
unregister: function(responderToRemove)
dispatch: function(callback,
request,
transport)
onCreate: function()
onComplete: function()
request: function(url)
onStateChange: function()
setRequestHeaders: function()
success: function()
{Boolean} -
getStatus: function()
respondToReadyState: function(readyState)
getHeader: function(name)
dispatchException: function(exception)
If the optional onException function is set, execute it and then dispatch the call to any other listener registered for onException.
getResponseHeader: function(name)
ALKMaps.Ajax.getElementsByTagNameNS = function(parentnode,
nsuri,
nsprefix,
tagname)
ALKMaps.Ajax.serializeXMLToString = function(xmldom)
Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.
GET: function (config)
Send an HTTP GET request.
The ALKMaps.Request namespace contains convenience methods for working with XMLHttpRequests.
{Object}
Close