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
81
On to the JavaScript
Now you’re ready to dig into some JavaScript. You know the name of
the function that you’ll be using to get the customer’s phone number:
getCustomerInfo(). This function needs to send the customer’s phone
number to Break Neck’s server, and ask for that customer’s address.
Let’s start out with just the function name:
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
function getCustomerInfo() {
...
}
Here’s where all
your code will go.
brain
power
Do you think there could be any problems with
event handlers that run JavaScript code that
then makes asynchronous requests? What
would happen if the pizza form sent a request
for an address, and then sent another request
before the rst response was returned? What
do you think the customer would see happen
on the order form?
Open up the examples for Head Rush Ajax that you
downloaded from http://www.headrstlabs.com. Go
into the chapter02/breakneck/ folder, and you’ll nd
pizza.html. This is the Break Neck order form, but
you need to make some changes to bring it up to
speed.
First, make sure the HTML matches the answers
from the Code Magnets exercise, ...
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