Monday, September 19, 2011

Ajax Ready States

Ajax ready states tell the browser what to do depending in different scenarios. What
to do while processing, or when a connection is complete.

They are as follows;

0: not initialized.

This is the state of the connection before the open
command is called.

1: connection established.

This state occurs after you have called the open command, but
before you have called the send command.

2: request received.

This occurs when the request has been sent, and at
the headers are available.

3: answer in process.

Here the information is being processed. At this point
you can display a wait message to the user.

4: finished.

This is the state when the request has been completed. At this point
you clear the wait message, and assign some other information to the
user if you wish.

Ready states are very useful in handling information being sent, and received from the server. You can display wait messages, and perform other tasks while a request is being made.

As you develop interactive websites, and online applications, you will become familiar Ajax ready states.

No comments:

Post a Comment

Programming for the Web