Google


ADBRITE ads links
You are here: CodeIdol.com > Ajax > Head Rush Ajax > Web Applications For A New Generation Using Ajax > Make Sure The Server Is Finished

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

1.9. Make sure the server is finished

Right now, your updatePage() function assumes that the server is finished when it runs... but that's not the case! To understand what's going on with your request, it's time to learn about ready states . Your request object has a ready state that tells the browser quite a bit about what state the request is in.

These are the request's ready states.
    Web BrowserHere, the connection is just getting initialized.
    Internet ExplorerAll done! The server's response is ready to be used.
    Firefox
    Opera
    Safari
    Mozilla
    PHP scriptNow the request is being worked on...
    Request
    ResponseThe server's almost finished with the request now.

A ready state tells the browser what stage a request is in.

1.9.1. Ready states are connected to your request object's onreadystatechange property

Do you remember the property you used in getBoardsSold() to tell the browser what to do when the server sent back a response? Take a look to refresh your memory:

    function getBoardsSold() {
      createRequest();
      var url = "getUpdatedBoardSales-ajax.php";
      request.open("GET", url, true);
      request.onreadystatechange = updatePage;This property
sets the function that the browser should run every time that the request's ready
state changes.This property affects every ready state, not just the
one indicating that the server is finished with a request.
      request.send(null);
    }


SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Ajax > Head Rush Ajax > Web Applications For A New Generation Using Ajax > Make Sure The Server Is Finished
   
Related tags







Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......






© CodeIdol Labs, 2007