Java Reference
In-Depth Information
The XMLHttpRequest Object
The XMLHttpRequest object, which is supported by most browsers, provides
asynchronous communication between a web browser and an underlying server.
Using the object, clients may submit XML data to a server, and retrieve it from the
server, without reloading the page. XML data may be converted to HTML on the
client side, using the DOM API and Extensible Stylesheet Transformations ( XSLT ).
The implementations of XMLHttpRequest may vary across browsers. For example,
an instance of an XMLHttpRequest object is created in IE 6 as follows:
var req = new ActiveXObject("Microsoft.XMLHTTP");
In Internet Explorer 7, XMLHttpRequest is available as a window object property. An
instance of an XMLHttpRequest object in IE 7 is created as follows:
var req = new XMLHttpRequest();
W3C has introduced an XMLHttpRequest object specification (
TR/XMLHttpRequest/ ) to standardize implementations of the XMLHttpRequest
object. The XMLHttpRequest object has various attributes/properties, which are
discussed in the following table, to provide HTTP client functionality.
Sets the callback method for asynchronous requests.
Retrieves the current state of a request.
0— XMLHttpRequest object has been created.
1—The object has been created and open() method has
been invoked.
2—The send() method has been called, but the response
has not been received.
3—Some data has been received that is available in the
responseText property. responseXML produces null and
response headers and status are not completely available.
4—Response has been received.
Retrieves the text of response from server.
Retrieves the XML DOM of response from server.
Retrieves the HTTP status code of request.
Retrieves the status text of the HTTP request.
XMLHttpRequest object methods, which are discussed in the following table, are
used to open an HTTP request, send the request, and receive the response.
Search WWH ::

Custom Search