« Home | AJAX Made Easy » | One Year With Microsoft » | Google Docs & Spreadsheets & ... » | April Fools » | Star Wars 30th Anniversary Mailboxes » | Frameset Bug in Internet Explorer » | State Map » | Opera on Nintendo Wii » | Lunch at Google » | Registering an Expiring Domain »

Queuing AJAX Requests

One issue people often overlook when building their first AJAX application surrounds multiple concurrent requests. Your AJAX application may display some non-deterministic behavior if you aren't careful to queue your XMLHttp requests.

Queuing requests is especially important in Internet Explorer as too many simultaneous request can actually cause IE to barf. Of course, we generally want to bundle requests together and avoid making concurrent requests. But no matter how you design your application, in the end you can't control how quickly your users clicks around within the UI.

The following demonstrates why queuing is important. In Firefox, you'll notice clicking the No Queue button leads to highly indeterminate results. Under Internet Explorer, the situation is worse. Firing off 50 simultaneous XMLHttp requests in IE can cause the browser to lock up. Queuing requests so that the next doesn't start until the first has finished fixes both of these problems.

........................................................................................................................................................................