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
31
next generation applications
We’ve still got plenty left to do, but let’s take a moment to see what’s already
done. Grab a cup of joe, let your brain relax, and review the rst two steps
in turning Katie’s report into an Ajax-powered app.
Reviewing what we’ve done
1
You added a new function, called createRequest(),
that creates a new request object. The code even works on
different browsers.
Create a new object to make requests to the server
2
You wrote another new function, called getBoardsSold().
This function used createRequest() to create a new
request object. Then, you set up a variable pointing to the
Ajax version of a PHP script on Katie’s server, initialized the
connection, and sent the request to the server.
Write a JavaScript function to request new board sales totals
We’ve got an Ajax-ready version
of the PHP script running on
Katie’s server now, too.
...and here’s what you did.
This was the original task
we had to complete...
You don’t need to submit the form
anymore... getBoardsSold() takes care
of making the request to the server.
<html>
<head>
<title>Boards ‘R’ Us</title>
<link rel=”stylesheet” type=”text/css”
href=”boards.css” />
</head>
<body>
<h1>Boards ‘R’ Us Sales Report</h1>
JavaScript
You’ll added this
JavaScript into the head
of your HTML.
createRequest()
now creates a new
request object.
<script>
var request...
function
createRequest()
{
...
}
</script ...
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