Property | Description |
---|---|
void open(method, URL) | Opens the request specifying get or post method and url. |
void open(method, URL, async, username, password) | Same as above but specifies username and password. |
void send() | Sends get request. |
void send(string) | Send post request. |
setRequestHeader(header,value) | It adds request headers. |
All modern browsers support the XMLHttpRequest object (Except IE5 and IE6 use an ActiveXObject).
An event handler for an event that fires at every state change.
The readyState property defines the current state of the XMLHttpRequest object. The following table provides a list of the possible values for the readyState property.
State | Description |
---|---|
0 | The request is not initialized. |
1 | The request has been set up. |
2 | The request has been sent. |
3 | The request is in process. |
4 | The request is completed. |
ReadyState = 0 : After you have created the XMLHttpRequest object, but before you have called the open() method.
readyState = 1 : After you have called the open() method, but before you have called send().
readyState = 2 : After you have called send().
readyState = 3 : After the browser has established a communication with the server, but before the server has completed the response.
readyState = 4 : After the request has been completed, and the response data has been completely received from the server.
All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have a built-in XMLHttpRequest object.
Syntax for creating an XMLHttpRequest object :
variable=new XMLHttpRequest();