Discussions

Blogs: Dealing with asychronous bugs in AJAX

  1. Dealing with asychronous bugs in AJAX (1 messages)

    Nick from the BadMagicNumber blog talks about how internet latencies can cause unpredictable in AJAX applications, if a human client clicks around and doesn't wait for a response. The solution is to either lock the view or pass view state down with each web request.

    Read AJAX: Best practice for Asynchronous Javascript.
  2. From the article: "This means having a flag variable that makes sure only one call is in progress at any time."

    Instead of doing that, quite often it is simpler and more effective to bind one XmlHttpRequest to a given data control. This is very useful for stuff like the detail popups at netflix.com (mouseover a title), or the suggest feature at google.com. Then you can do something like:

    if(xmlHttp.readyState != 0)
    { xmlHttp.abort(); }

    in the method that performs the request.

    Joe