statusText
Summary
Returns the HTTP status text.
Property of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest
Syntax
Note: This property is read-only.
var result = element.statusText;
Return Value
Returns an object of type StringString
Examples
// The following script checks the status to determine if the request was successful
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://localhost/test.xml", false);
xhr.send()
if (xhr.statusText == "OK")
console.log(xhr.responseText);
else
console.log(xhr.statusText);
Related specifications
- W3C XMLHttpRequest Specification
- W3C Working Draft
Attributions
Microsoft Developer Network: Windows Internet Explorer API reference Article