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.

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