(Translated by https://www.hiragana.jp/)
XMLHttpRequest Object
The Wayback Machine - https://web.archive.org/web/20080413183618/http://msdn2.microsoft.com:80/en-us/library/ms535874(VS.85).aspx
Click to Rate and Give Feedback
 XMLHttpRequest Object
XMLHttpRequest Object

Represents an XML request via HTTP.

Members Table

The following table lists the members exposed by the XMLHttpRequest object.

Attributes/Properties
Show:
PropertyDescription
onreadystatechange Sets or retrieves the event handler for asynchronous requests.
readyState Retrieves the current state of the request operation.
responseBody Retrieves the response body as an array of unsigned bytes.
responseText Retrieves the response body as a string.
responseXML Retrieves the response body as an XML Document Object Model (DOM) object.
status Retrieves the HTTP status code of the request.
statusText Retrieves the friendly HTTP status of the request.
timeout New for Windows Internet Explorer 8  Gets or sets the time-out value.
EventDescription
ontimeout New for Internet Explorer 8  Raised when there is an error that prevents the completion of the request.
MethodDescription
abort Cancels the current HTTP request.
getAllResponseHeaders Returns the complete list of response headers.
getResponseHeader Returns the specified response header.
open Assigns method, destination URL, and other optional attributes of a pending request.
send Sends an HTTP request to the server and receives a response.
setRequestHeader Adds custom HTTP headers to the request.

Remarks

The XMLHttpRequest property is available on the window object in Internet Explorer 7.

var oReq = new XMLHttpRequest;

With the XMLHttpRequest object, Internet Explorer clients can retrieve and submit XML data directly to a Web server without reloading the page. To convert XML data into renderable HTML content, use the client-side XML DOM or Extensible Stylesheet Language Transformations (XSLT) to compose HTML elements for presentation.

The native scripting object also supports the use of expandos (custom properties), and properly recognizes the 'this' notation of Javascript.

For clients prior to Internet Explorer 7, use the following syntax to create the object:

var oReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");

Example

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);
}

Standards Information

This object is defined in The XMLHttpRequest Object (W3C Working Draft) World Wide Web link.

Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker