XMLHttpRequest

< apis‎ | xhr‎ | properties
Jump to: navigation, search

XMLHttpRequest



Needs Summary: This article does not have a summary. Summaries give a brief overview of the topic and are automatically included on some listing pages that link to this article.

Property of dom/window

Syntax

Note: This property is read-only.

var xhr = window.XMLHttpRequest;

Return Value

Returns an object of type DOM Node.

An XMLHttpRequest instance object.

Examples

The following script demonstrates how to create and use the XMLHttpRequest object:

JavaScript

if (window.XMLHttpRequest)
{
  var xhr = new XMLHttpRequest();
  xhr.open("GET", "http://localhost/test.xml", true);
  xhr.onreadystatechange =
    function () {
      if (xhr.readyState === 4) {
        console.log(xhr.statusText);
     }
    };
   xhr.send();
}



Related specifications

Specification Status Related Changes
XMLHttpRequest Working Draft Section 3

Compatibility

Desktop

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic Support 1
1
7
8
1.2

Mobile

Feature Android BlackBerry Chrome for mobile Firefox Mobile (Gecko) IE Mobile Opera Mobile Opera Mini Safari Mobile
Basic support ? ? ? ? ? ? ? ?


Compatibility notes

Browser Version Note
Internet Explorer 5.5 - 6 Using the XMLHttp ActiveX object, you could emulate the XMLHttpRequest.

See also

Related pages (MSDN)

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]