View Single Post
  #1 (permalink)  
Old April 11th, 2006, 08:00 PM
jminatel's Avatar
jminatel jminatel is offline
Wrox Staff
Points: 18,940, Level: 59
Points: 18,940, Level: 59 Points: 18,940, Level: 59 Points: 18,940, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2003
Location: Indianapolis, IN, USA.
Posts: 1,945
Thanks: 73
Thanked 139 Times in 101 Posts
Default New Ajax Article: Ajax Submission Throttling

The most recent new excerpt from Nicholas C. Zakas' work (Professional Ajax co-author and Professional JavaScript 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 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.

Jim Minatel
Senior Acquisitions Editor
Wiley Technology Publishing
WROX Press
Jim's Book of the week: No book this week - Donate to the Red Cross!
Jim Minatel
Associate Publisher, WROX - A Wiley Brand
Did someone here help you? Click on their post!
Reply With Quote