Monday, December 7, 2009

A Queue of AJAX Requests

Till now, I hadn't written code to fire off a number of AJAX requests with callbacks in rapid succession. The code wasn't working as hoped, and usually only the last callback would succeed. This is because a new AJAX request is being made before the callback for the previous request has finished executing. Due to their being only one XMLHttpRequest, concurrency issues prevail. A possible solution involves creating a queue for the requests and only firing the next request once the callback for the previous one has completed.

No comments: