tags:

views:

74

answers:

1

We have a jQuery app where some requests for the same URL may take much longer than others. The user fires off ajax posts (by making a change in the UI), these fire off a get request on success that updates the UI. When the earliest of the get requests takes a long time, the later one (which is much quicker) is delayed until the slower one finishes in FF & chrome, but not IE.

POST1 (associated with success1), returns OK quickly
POST2 (associated with success2)
success1 and 2 are the same function

now,
success1 -> GET which takes a long time (we expect this)
success2 -> GET which should return quickly (before response to success1)
(both GETs, above, are to the same URL)

what we're seeing:
in IE: success 2 completes quickly, success1 completes later
in chrome and FF: success2 is being held up until success1 completes :-(

We expect success2 to complete before success1.

Any idea why there is the delay in FF and chrome, and what we might do to diagnose/fix this?

A: 

Any chance of providing the precise code, client side, that encounters this problem? I would prefer to analyse your code to determine the problem and fix, rather than invent some of my own which may or may not exhibit the problem. Regards

Jim Grant
thanks for the offer Jim - it's a little complex to recreate since you'd need to have a server-side that also emulates the fact that one ajax call gets a quick response and the other a slow one. in the end we used http://code.google.com/p/jquery-ajaxq/ to implement a queue of ajax requests that we had more fine-grained control over...
hwjp