Skip to Main Content
Head Rush Ajax
book

Head Rush Ajax

by Brett McLaughlin
March 2006
Beginner to intermediate content levelBeginner to intermediate
448 pages
13h 33m
English
O'Reilly Media, Inc.
Content preview from Head Rush Ajax
204
Chapter 4
Meet the DOM
Although you may not have realized it, you’ve been using the DOM
since way back in Chapter 1. Remember this code from Katie’s
Boards ‘R’ Us report?
(again)
function updatePage() {
var newTotal = request.responseText;
var boardsSoldEl = document.getElementById(“boards-sold”);
var cashEl = document.getElementById(“cash”);
...
}
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);
}
And here’s some similar code from the Break Neck pizza app:
The document object gives
JavaScript access to the DOM tree
that the web browser creates.
Here’s that
document
object again.
The “document”
object gives
your JavaScript
access to the
web browser’s
DOM tree.
Don’t miss this... it’s
probably the most important
thing in the whole chapter!
a dom retrospective
We’ve left out the rest of the
code from this function.
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

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
Head First Ajax

Head First Ajax

Rebecca M. Riordan

Publisher Resources

ISBN: 0596102259Errata PageSupplemental Content