Browser/User Agent Support
| IE | Mozilla | Netscape | Opera | Safari | Netscapte | 7.0+ | 1.0+ | 7.0+ | no | no | no |
|---|
Constructors
| Constructor | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Creates a new instance of an XMLHttpRequest object. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Properties
| Property | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Event handler that fires when readystate changes value. Default is null. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Returns the current state of an object. Valid values are 0 = uninitialized, 1 = open, 2 = sent, 3 = receiving, 4 = loaded. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Response formatted as a string. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Response formatted as an XML document. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Status of the Response. (e.g. 200 = "OK", 404 = "Not Found", etc.) | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Response text corresonding to status (e.g. "OK", "Not Found", etc.) | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Methods
| Method | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Cancels the current request. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Returns all HTTP headers as a single string. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Returns the value of the specified HTTP header. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Initializes the request with the specified parameters. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Sends the request. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
Sets a header and a value for the request. | 7.0+ | 1.0+ | 7.0+ | no | no | no |
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
Constructor Detail
XMLHttpRequest XMLHttpRequest()
Creates a new instance of an XMLHttpRequest object.
- Visibility
- internal
Property Detail
Function onreadystatechange
Event handler that fires when readystate changes value. Default is null.
- Availability
HTML DOM Level 3 | W3C
Number readyState - read only
Returns the current state of an object. Valid values are 0 = uninitialized, 1 = open, 2 = sent, 3 = receiving, 4 = loaded.
- Availability
HTML DOM Level 3 | W3C
String responseText - read only
Response formatted as a string.
- Availability
HTML DOM Level 3 | W3C
Document responseXML - read only
Response formatted as an XML document.
Number status - read only
Status of the Response. (e.g. 200 = "OK", 404 = "Not Found", etc.)
- Availability
HTML DOM Level 3 | W3C
String statusText - read only
Response text corresonding to status (e.g. "OK", "Not Found", etc.)
- Availability
HTML DOM Level 3 | W3C
Method Detail
abort() : void
Cancels the current request.
- 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.
- 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.
| String | header | Name of the HTTP header. |
- 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.
| 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 | If true, specifies that the request should be handled asyncrhonously. (optional) |
| String | user | Username to send in the request. (optional) |
| String | password | Password to send in the request. (optional) |
- 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.
| String, Document | data | Data (content) to send for the request. Can be a String or an XML Document. |
- 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.
| String, Document | header | Name of the header. |
| String, Document | value | Value of the header. |
- 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
