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
187
asynchronous applications
s
e
n
d
(
)
o
p
e
n
(
)
s
e
t
R
e
q
u
e
s
t
H
e
a
d
e
r
s
(
)
Request Object
The same request object sends
another request to the coffee
maker for Bob’s order.
Make Bob a medium latte using
the second coffee maker
coffeemaker.php
3
Now enter another order, for Bob. Bob
wants a medium latte. Click “Order
Coffee”, and Bob’s order should start
brewing on the second coffee maker.
The same request object is
used to send the request
for Bob’s coffee order.
s
e
n
d
(
)
o
p
e
n
(
)
s
e
t
R
e
q
u
e
s
t
H
e
a
d
e
r
s
(
)
Request Object
But what about Jim’s order?
Do you see the problem? Jim’s order is still brewing, but now there’s
no request object attached to that request! The request for Bob’s order
overwrote the information in the request object related to Jim’s order:
Bob’s order
Jim’s order
There’s no request object set up
to indicate a callback to run or
receive a server’s response from
the browser when the server
nishes with Jim’s order.
Bob’s order is set up normally. The
request object will tell the browser
what callback function to run, and the
callback can get the server’s response
from the request object.
A request object can be
used to make multiple
requests, but can only keep
track of one response from
the server at a time.
The connection between the
request object and Jim’s order
was overwritten when Bob
placed his order.
4
Bob’s order will
nish normally,
but Jim’s order ...
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