This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

responseXML

Summary

Returns the response to the request as a DOM Document object, or null if the request was unsuccessful, has not yet been sent, or cannot be parsed as XML or HTML.

Property of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest

Syntax

Note: This property is read-only.

var result = element.responseXML;

Return Value

Returns an object of type

DOM Document.

Examples

// The following example uses the XML DOM to display the response body

var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/books.xml", false);
xhr.send();
console.log(xhr.responseXML.xml);

Related specifications

W3C XMLHttpRequest Specification
W3C Working Draft

Attributions