Instantiates the XMLHttpRequest object for the window.
Syntax
[ oRequest = ] window.XMLHttpRequest
Possible Values
oRequest |
Object that
receives the XMLHttpRequest. |
The property is read-only.
The property has no default value.
Remarks
XMLHttpRequest was introduced in Internet Explorer 7
Examples
The following script demonstrates how to create and use the XMLHttpRequest object:
if (window.XMLHttpRequest)
{
var oReq = new XMLHttpRequest();
oReq.open("GET", "http://localhost/test.xml");
oReq.send();
alert(oReq.statusText);
}
The XMLHttpRequest property can be disabled for security reasons. The following example uses structured exception handling to catch an unexpected error in creating the object:
try {
var oReq = new XMLHttpRequest();
alert('Object created.');
}
catch(e) {
alert('Cannot create object!');
}
Applies To