# Ajax.js

Summary

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

### Functions

### OpenLayers.nullHandler

> OpenLayers.nullHandler = function( | request | )

@param {} request

### OpenLayers.loadURL

> OpenLayers.loadURL = function( | uri,
> | params,
> | caller,
> | onComplete,
> | onFailure | )

Background load a document. Deprecated. Use OpenLayers.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, OpenLayers.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, OpenLayers.nullHandler will be called (which pops up a user friendly error message dialog).

#### Returns

{OpenLayers.Request.XMLHttpRequest} The request object. To abort loading, call request.abort().

### OpenLayers.parseXMLString

> OpenLayers.parseXMLString = function( | text | )

Parse XML into a doc structure

#### Parameters

text | {String}

#### Returns

{?} Parsed AJAX Responsev

## OpenLayers.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}

## OpenLayers.Ajax.Responders

{Object}

Summary

Properties |
responders | {Array}
Functions |
register |
unregister |
dispatch |
onCreate |
onComplete |

### 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()

## OpenLayers.Ajax.Base

Summary

Constructor |
OpenLayers.Ajax.Base |

### Constructor

### OpenLayers.Ajax.Base

#### Parameters

options | {Object}

## OpenLayers.Ajax.Request

Deprecated. Use OpenLayers.Request method instead.

#### Inherit

- OpenLayers.Ajax.Base

Summary

Properties |
_complete | {Boolean}
Constructor |
OpenLayers.Ajax.Request |
Functions |
request |
onStateChange |
setRequestHeaders |
success | {Boolean} -
getStatus |
respondToReadyState |
getHeader |
dispatchException | If 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

### OpenLayers.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 OpenLayers.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 OpenLayers.Ajax.Responders for onException.

#### Parameters

exception | {?}

### Properties

### Events

{Array(String)}

## OpenLayers.Ajax.Response

Summary

Properties |
status | {Integer}
statusText | {String}
Constructor |
OpenLayers.Ajax.Response |
Functions |
getStatus |
getStatustext |
getHeader |
getResponseHeader |
getElementsByTagNameNS |
serializeXMLToString | Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.

### Properties

### status

{Integer}

### statusText

{String}

### Constructor

### OpenLayers.Ajax.Response

#### Parameters

request | {Object}

### Functions

### getStatus

### getStatustext

#### Returns

{String} | statusText

### getHeader

### getResponseHeader

> getResponseHeader: function( | name | )

#### Returns

{?} | response header for given name

### getElementsByTagNameNS

> OpenLayers.Ajax.getElementsByTagNameNS = function( | parentnode,
> | nsuri,
> | nsprefix,
> | tagname | )

#### Parameters

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

#### Returns

{?}

### serializeXMLToString

> OpenLayers.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

{?}

> OpenLayers.nullHandler = function( | request | )

@param {} request

> OpenLayers.loadURL = function( | uri,
> | params,
> | caller,
> | onComplete,
> | onFailure | )

Background load a document.

> OpenLayers.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 | )

> OpenLayers.Ajax.getElementsByTagNameNS = function( | parentnode,
> | nsuri,
> | nsprefix,
> | tagname | )

> OpenLayers.Ajax.serializeXMLToString = function( | xmldom | )

Wrapper function around XMLSerializer, which doesn’t exist/work in IE/Safari.

> GET: function( | config | )

Send an HTTP GET request.
Standard-compliant (W3C) cross-browser implementation of the XMLHttpRequest object.
The OpenLayers.Request namespace contains convenience methods for working with XMLHttpRequests.
{Object}
Close