Section 1.14. Reviewing the highlight reel


1.14. Reviewing the highlight reel

Asynchronous applications make requests using a JavaScript object, and not a form

Your requests and responses are handled by the web browser, not directly by your JavaScript code.

Once the web browser gets a response to your asynchronous request, it will "call back" your JavaScript with the server's response.

1.14.1. Wait! Stop the presses!

Everything works on Katie's Mac, but on my Windows machine, I only get new sales totals the first time I click "Show Me the Money". After that, I just get the same numbers over and over... what's up with that?

Katie's brother and business manager. He's a die-hard Windows guy, even though Katie is a Mac-lover.

Here's the report after clicking "Show Me the Money" once... it's got new figures.

The first time using Internet Explorer, everything works great...

...but then, each time you press "Show Me the Money", the same numbers come back up. There's definitely a problem on Windows.

1.14.2. What's going on?

Did we do something wrong?

Do Ajax apps not work on Internet Explorer?

For answers to these questions and more, you'll have to wait for Chapter 2...

60 Second Review

  • Traditional web programming involves making requests to a server, and getting back a response, usually with updated data wrapped up in a completely new HTML page.

  • Ajax apps use asynchronous JavaScript.

  • Ajax applications can make requests and get responses without reloading an entire page.

  • Asynchronous JavaScript doesn't wait on a server to respond to a request. Users can keep using a page, even while the server is still working on the request.

  • Web browsers turn HTML and CSS into pages you can see on your screen, and take care of running any JavaScript in the page.

  • In Ajax applications, servers usually send back just the data you request, without any additional HTML markup and presentation.

  • You can use JavaScript to make both synchronous and asynchronous requests to a web server.

  • JavaScript offers several event handlers to call JavaScript code when certain events happen; onChange () and onClick () are two common examples.

  • The browser always knows what ready state a request is in, and makes that available to your JavaScript functions.

  • You can have the browser run a JavaScript function every time a request's ready state changes using the onreadystatechange property in your request object.

  • When the ready state of a request is "4", the request has been processed, and the server has a response ready.





Head Rush Ajax
Head Rush Ajax (Head First)
ISBN: 0596102259
EAN: 2147483647
Year: 2004
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net