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
94
Chapter 2
Back to getCustomerInfo()
With the request object taken care of, let’s get back
to coding getCustomerInfo(). Remember
where we left this function?
function getCustomerInfo() {
var phone = document.getElementById(“phone”).value;
createRequest();
var url = “lookupCustomer.php?phone=” +
escape(phone);
request.open(“GET”, url, true);
request.onreadystatechange = updatePage;
request.send(null);
}
Get rid of
this line... now
our request
object is
created
in static
JavaScript.
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
talking to the server
This is the code you
wrote back in Step 1.
Talking to the server-side guys
Here’s what we need to have the server-side
guys take care of for us:
Next up is getting the
PHP script working on
the Break Neck server.
Name the script lookupCustomer.php.
Create a new PHP script to lookup a customer’s
address based on their phone number.
Figure out how the script will accept the
customer’s phone number.
Make sure the script doesn’t return any
HTML... we just want the customer’s address.
1
2
3
4
Draw a line connecting each
of these four points to the
statement in the Team Chat
on ...
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