Are you checking out this book's forum to try to decide if you should buy it? Here's another sneak peek for you then - another excerpt! (Yes, I know this is an xpost - report me to the moderator!)
The most recent new excerpt from Nicholas C. Zakas' work (Professional Ajax
for Web Developers author) is this article adapted from Professional Ajax
by Nicholas C. Zakas, Jeremy McPeak, and Joe Fawcett (Wrox, 2006, ISBN: 0-471-77778-1), from chapter 3 "Ajax Patterns." Nicholas' previous articles on wrox.com include Ajax and the Yahoo! Connection Manager
and XMLHttp Requests for Ajax
which is an excerpt from chapter 2 "Ajax Basics" of Professional Ajax. Here's the beginning of the newest excerpt:
Since Ajax emphasizes avoiding page refreshes, the question of when to send user data is important. In a traditional web site or web application, each click makes a request back to the server so that the server is always aware of what the client is doing. In the Ajax model, the user interacts with the site or application without additional requests being generated for each click.
One solution would be to send data back to the server every time a user action occurs, similar to that of a traditional web solution. Thus, when the user types a letter, that letter is sent to the server immediately. The process is then repeated for each letter typed. The problem with this approach is that it has the possibility to create a large number of requests in a short amount of time, which may not only cause problems for the server but may cause the user interface to slow down as each request is being made and processed. The Submission Throttling design pattern is an alternative approach to this problematic issue.
Using Submission Throttling, you buffer the data to be sent to the server on the client and then send the data at predetermined times. The venerable Google Suggest feature does this brilliantly. It doesn't send a request after each character is typed. Instead, it waits for a certain amount of time and sends all the text currently in the text box. The delay from typing to sending has been fine-tuned to the point that it doesn't seem like much of a delay at all. Submission Throttling, in part, gives Google Suggest its speed.
Here's the rest of the article
Senior Acquisitions Editor
Wiley Technology Publishing
Jim's Book of the week: No book this week - Donate to the Red Cross!