AJAX - The Complete Reference

(avery) #1

62 Part I: Core Ideas


Browser Native ActiveX
Mozilla 1+ Yes No
Netscape 7+ Yes No

Internet Explorer 5 No Yes
Internet Explorer 5.5 No Yes
Internet Explorer 6 No Yes

Internet Explorer 7 Yes Yes
Opera 8+ Yes No
Safari 1.2+ Yes No

TABLE 3-1 XMLHttpRequest Object Support by Browser

Property or Method Description
readyState Integer indicating the state of the request, either:
0 (uninitialized)
1 (loading)
2 (response headers received)
3 (some response body received)
4 (request complete)
onreadystatechange Function to call whenever the readyState changes

status HTTP status code returned by the ser ver
(e.g., “200, 404, etc.”)
statusText Full status HTTP status line returned by the ser ver (e.g.,
“OK, No Content, etc.”)
responseText Full response from the ser ver as a string
responseXML A Document object representing the ser ver’s response
parsed as an XML document
abort() Cancels an asynchronous HTTP request
getAllResponseHeaders() Returns a string containing all the HTTP headers the ser ver
sent in its response. Each header is a name/value pair
separated by a colon and header lines are separated by a
carriage return/linefeed pair
getResponseHeader(header
Name)

Returns a string corresponding to the value of the
headerName header returned by the ser ver
(e.g., request.getResponseHeader("Set-cookie")

TABLE 3-2 Common Properties and Methods of the XMLHttpRequest Object
Free download pdf