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
you’re on your way 4
103
ajax requests
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 Phone Number
Customer’s Address
Customer’s Order
Step 3: Retrieve the customer’s address
In this step, we need to use the address that the Break Neck PHP
script will return in response to the request we made in Step 2.
Then, we can have the browser run a JavaScript function once
it has a response from the Break Neck server, and pass along the
address from the script.
<script>
var request...
function foo()
{
...
}
</script>
Customer’s Address
Web Server
We’ll need to write this JavaScript
function. It can get the server’s
response from the request object you
created back in Step 2.
Remember, it’s the browser that gets
the response from the server. Then, it
“calls back” the JavaScript function you
specied in your request object.
Here’s where the browser
runs your callback function.
The Break Neck PHP script looks
up the customer by his phone
number, and returns his address.
The browser runs your callback function every time
the ready state of your request object changes.
On to the next step in
coding Break Neck.
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