Sys.Net.XmlHttpExecutor statusText Property

Gets the status text from the browser's XMLHTTP object.

Note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

var statusText = MyExecutor.get_statusText();

Exceptions

Exception type

Condition

Sys.InvalidOperationException

The statusText property was accessed outside the event handler.

-or-

The statusText property was accessed after the completed event occurred

Return Value

The status text from the browser's XMLHTTP object as a string (for example, "200 OK. The request has succeeded."). For more information, see About Native XMLHTTP.

Remarks

If the request completed successfully, you can get the value of the statusText property to get the status text from the browser's XMLHTTP object.

You can use the statusText property only in code that is running inside a completed event handler, or running in the call stack of the completed event handler. An exception is thrown if you use the statusText property when the executor did not return successfully, or if the XmlHttpExecutor.get_responseAvailable method returns false. An exception is also thrown if you use the statusText property after the completed event has occurred. This is because the executor has released its reference to the browser's XMLHTTP object.

Example

The following example shows how to use the statusText property. This code is part of a complete example found in the Sys.Net.XmlHttpExecutor class overview.

// Display the Web request status. 
resultElementId.innerHTML +=
   "Request Status: [" + executor.get_statusCode() + " " + 
             executor.get_statusText() + "]" + "<br/>";

See Also

Reference

Sys.Net.WebRequestManager Class

Sys.Net.WebRequestExecutor Class

Sys.Net.XMLHttpExecutor Class