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
196
Chapter 3
That’s all ne, but I want to see what
happens in this application when it’s
not
asynchronous. I want to compare the
synchronous and asynchronous versions,
and see if the asynchronous version is
really that much better.
Skeptical?
So, you want to see for yourself how different the Coffee Maker
program is as a synchronous application? That’s easy to do. All you have
to do is change the third argument of the call to request.open() in
the sendRequest() function: switch it from true to false:
function sendRequest(request, url) {
request.onreadystatechange = serveDrink;
request.open(“GET”, url, false);
request.send(null);
}
Change the argument from true to false to tell
your application to send the request to the coffee
makers on the server synchronously.
Then give it a try. What happens?
synchrony versus asynchrony
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