# XMLHttpRequest : Object
Return to: HTML DOM Level 2 index

Object that transfers data between a web client and a remote web server.

## Platform Support

IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | ---
7.0+ | 1.0+ | 7.0+ | no | no

## Constructors

Constructor | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
XMLHttpRequest Constructor() : XMLHttpRequest Creates a new instance of an XMLHttpRequest object. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

### XMLHttpRequest() : XMLHttpRequest

Creates a new instance of an XMLHttpRequest object.

Returns

XMLHttpRequest |

Visibility
  internal

## Properties

Property | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
onreadystatechange : Function Event handler that fires when readystate changes value. Default is null. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Availability

  HTML DOM Level 3|W3C

readyState : Number Returns the current state of an object. Valid values are 0 = uninitialized, 1 = open, 2 = sent, 3 = receiving, 4 = loaded. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Availability

  HTML DOM Level 3|W3C

responseText : String Response formatted as a string. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Availability

  HTML DOM Level 3|W3C

responseXML : Document Response formatted as an XML document. | No Details | 7.0+ | 1.0+ | 7.0+ | no | no

status : Number Status of the Response. (e.g. 200 = "OK", 404 = "Not Found", etc.) | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Availability

  HTML DOM Level 3|W3C

statusText : String Response text corresonding to status (e.g. "OK", "Not Found", etc.) | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Availability

  HTML DOM Level 3|W3C

## Functions

Method | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
abort() : void Cancels the current request. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Returns

void |

Remarks
  Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.
Availability

  HTML DOM Level 3|W3C

getAllResponseHeaders() : String Returns all HTTP headers as a single string. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Returns

String |

Remarks
  Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.
Availability

  HTML DOM Level 3|W3C

getResponseHeader(String header) : String Returns the value of the specified HTTP header. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Parameters

String | header | Name of the HTTP header.

Returns

String |

Remarks
  Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.
Availability

  HTML DOM Level 3|W3C

open(String method, String uri, [Boolean async,] [String user,] [String password]) : void Initializes the request with the specified parameters. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Parameters

String | method | Name of the HTTP method. Specify a value of GET, POST, HEAD, or PUT.
String | uri | Complete URI or relative URI that can be resolved to a complete URI.
Boolean | async | (optional)If true, specifies that the request should be handled asyncrhonously.
String | user | (optional)Username to send in the request.
String | password | (optional)Password to send in the request.

Returns

void |

Remarks
  Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.
Availability

  HTML DOM Level 3|W3C

send(String, Document data) : void Sends the request. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Parameters

String, Document | data | Data (content) to send for the request. Can be a String or an XML Document.

Returns

void |

Remarks
  Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.
Throws
    Throws an INVALID_STATE_ERR error if the send method is called when readyState has an inappropriate value.
Availability

  HTML DOM Level 3|W3C

setRequestHeader(String, Document header, String, Document value) : void Sets a header and a value for the request. | Show Details | 7.0+ | 1.0+ | 7.0+ | no | no

Parameters

String, Document | header | Name of the header.
String, Document | value | Value of the header.

Returns

void |

Remarks
  Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.
Throws
    Throws an UNKNOWN_ERR error.
Availability

  HTML DOM Level 3|W3C

## Remarks

Although currently recognized by most browsers, the XMLHttpRequest object will be part of the HTML DOM Level 3 specification.

## Availability

HTML DOM Level 3|W3C

text_javascript aptana_docs