Page 2 of
6
<< Previous
1 2
3 4
5 6
Next >>
|
AJAX (Asynchronous JavaScript And XML) Tutorial
The XMLHttpRequest Object
|
You need to know some background on the XMLHttpRequest object before you can use
it. The XMLHttpRequest object has the following important properties and
methods:
readyState Property
The readyState property contains the status of the
server's response as shown in the following table.
State
|
Meaning
|
0
|
The request was initialized
|
1
|
The request was set up
|
2
|
The request was sent
|
3
|
The request is in process
|
4
|
The request is complete
|
status Property
The Status property holds the HTTP status code
returned from the server. A valid code of 200 is desired. Invalid codes may
include 404 - Page Not Found, 500 - Server Error, etc.
responseText Property
The responseText property contains the data sent
back from the server as a text string.
responseXML Property
The responseXML property contains the data sent
back from the server as an XML document.
onreadystatechange Property
The onreadystatechange property stores the
function that will process the response from a server.
open Method
The open method is used to open a HTTP request and
takes three arguments. The first argument denotes which method, GET or POST, to
use when sending the request. The second argument indicates the URL of the
server-side script. The last argument dictates whether the request should be
run asynchronously.
send Method
As its name implies, the send method sends the
request to the server.
|
Page 2 of
6
<< Previous
1 2
3 4
5 6
Next >>
|
|
About TheScarms
Sample code version info
|