HTML and CSS Reference
In-Depth Information
Table 18.1 XMLHttpRequest Properties and Event Handlers
XMLHttpRequest Property
Value
status
The HTTP status code of the request response; for example,
200 or 404.
statusText
Returns the HTTP status code from server response as a
string us as OK or Not Found.
readyState
A number representing the current state of the object (see
Table 18.3).
responseText
Returns a string value of unparsed text as a response from
the server.
responseXML
Returns response parsed into a DOM if Content-type is
text/xml. Used to get multiple values.
onreadystatechange
The event handler that is called when the readyState
changes.
onerror
Mozilla event handler that is called when an error happens
during a request.
onprogress
Mozilla event handler called as content is loaded.
onload
Mozilla event handler called when the document is finished
loading.
Table 18.2 XMLHttpRequest Methods
XMLHttpRequest Method
What It Does
abort()
Cancels the request.
getAllResponseHeaders()
Returns a string of all the HTTP headers separated by a
newline.
getResponseHeader(“server”)
Returns the value of a specific HTTP header; for example,
“Server” or “Last-Modified”.
open()
Initializes the XMLHttpRequest object with GET or POST,
URL, and so on.
send()
Sends the request.
setRequestHeader()
Adds a key/value pair to add to the header that will be sent
to the server.
 
Search WWH ::




Custom Search