Skip to Content
Head Rush Ajax
book

Head Rush Ajax

by Brett McLaughlin
March 2006
Beginner to intermediate
448 pages
13h 33m
English
O'Reilly Media, Inc.
Content preview from Head Rush Ajax
108
Chapter 2
You’ve seen what the Break Neck server is doing, and you’re
written a lot of new JavaScript, but what’s the browser doing as
all these ready states are changing?
Let’s take a look and nd out:
What is the browser doing?
Web Browser
Internet Explorer
Firefox
Opera
Safari
Mozilla
1
2
3
4
These are the request’s ready states.
<?php
require(‘lib.php’);
function go() {
$myVar = ...
return ...
}
?>
1
2
<script>
var request...
function foo()
{
...
}
</script>
PHP script
JavaScript
updatePage()
3
4
Request
Object
5
6
1. The browser runs
getCustomerInfo(), and a request is
made to the Break Neck web server.
2. As the request is being worked
on, the ready state of the request
is changed to reect what stage of
processing the request is in.
3. Each time the ready
state of the request
changes, the browser
runs your callback
function, updatePage().
4. updatePage() checks
the request object’s
ready state, and only
keeps running if the
request is nished.
6. If the request is nished,
updatePage() can get the server’s
response from the request object.
5. When the browser gets a
completed response from the
server, it stores the server’s
response in the request object.
Man, Break Neck pizza rocks. There’s
nothing like a breakfast of cold pizza, a
whipped latte from Starbuzz, and the
Webville Times to read.
<script>
var request...
function foo()
{
...
}
</script>
JavaScript
<script>
var request...
function foo()
{
...
}
</script>
Customer’s ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally

Publisher Resources

ISBN: 0596102259Errata PageSupplemental Content