JavaScript Reference

Local Navigation

XMLHttpRequest API

Object

Description

Availability

XMLHttpRequest

Enables you to transfer data to and from a server without reloading or replacing the current document.

4.6 or later

Object: XMLHttpRequest

Availability

BlackBerry Device Software version 4.6 or later

The XMLHttpRequest object enables you to transfer data to and from the server without reloading or replacing the current document.

To make an HTTP request, you create the instance of the object, open a URL, and send the request. The HTTP status code of the result, as well as the result document are available in the request object afterwards.

Because it allows you to communicate with a server in the background, the XMLHttpRequest object enables you to create extremely dynamic documents.

Back To Top

XMLHttpRequest properties

Property name

Type

Description

Status

Support level

Availability

readyState

unsigned short

Returns the status of the server's response. Each time the readyState property changes, the onreadystatechange function will be executed.

read only

XMLHttpRequest

4.6 or later

responseText

DOMString

Returns the response text entity body. This might return only a fragment of the entity body, if the request response is still in the loading state.

read only

XMLHttpRequest

4.6 or later

responseXML

DOMString

Returns the XML response entity body. This might return only a fragment of the entity body, if the request response is still in the loading state.

read only

XMLHttpRequest

4.6 or later

status

unsigned short

Returns the HTTP status code sent by the server, or, if no status code is available, throws an INVALID_STATE_ERR exception.

read only

XMLHttpRequest

4.6 or later

statusText

DOMString

Returns the HTTP status text sent by the server, or, if no status text is available, throws an INVALID_STATE_ERR exception.

read only

XMLHttpRequest

4.6 or later

Back To Top

XMLHttpRequest event handlers

Property name

Type

Description

Status

Support level

Availability

onreadystatechange

EventListener

Specifies the function to perform when a form control loses focus after the user has modified the value.

writable

XMLHttpRequest

4.6 or later

Back To Top

XMLHttpRequest methods

Method name

Description

Support level

Availability

abort()

Stops the current request in progress, which sets the value for XMLHttpRequest.readyState to DONE

XMLHttpRequest

4.6 or later

addEventListener()

Adds an EventListener object to a set of event listeners for the given node.

DOM 2 Events

4.6 or later

dispatchEvent()

Dispatches an Event object created by Document.createEvent().

DOM 2 Events

4.6 or later

getAllResponseHeaders()

Returns a complete set of headers and their values.

XMLHttpRequest

4.6 or later

getResponseHeader()

Returns the value of the given header.

XMLHttpRequest

4.6 or later

open()

Assigns the HTTP method and destination URL, and possibly some additional parameters, for a pending request.

XMLHttpRequest

4.6 or later

removeEventListener()

Removes an event listener from an EventTarget.

DOM 2 Events

4.6 or later

send()

Sends the request to the URL specified by XMLHttpRequest.open().

XMLHttpRequest

4.6 or later

setRequestHeader()

Specifies the value of a header to be sent with the request.

XMLHttpRequest

4.6 or later

Back To Top
Previous topic: XMLSerializer methods

Was this information helpful? Send us your comments.