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
101
ajax requests
function getCustomerInfo() {
var phone = document.getElementById(“phone”).value;
var url = “lookupCustomer.php?phone=” + escape(phone);
request.open(“GET”, url, true);
request.onreadystatechange = updatePage;
request.send(null);
}
All that’s left to complete this step is to actually send the request.
This is a piece of cake, as you saw in Chapter 1. Let’s look at the last
line of getCustomerInfo() now:
Send the request to the server
This sends the request to the
Break Neck web server.
We sent the customer’s phone
number as part of the request
URL, so we don’t need to send any
other data to the server.
Make sure you’re keeping your version of pizza.html up to date.
Open up pizza.html, and add the getCustomerInfo() function if
you haven’t already. You should also have lookupCustomer.php
in the same directory as your pizza.html and breakneck.css les.
So I’m still waiting to nd out more
about when that ready state changes.
Make sure you set up
the function for the
browser to run when
the ready state changes
before you call send().
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