开发者

jQuery ajax requests: Success functions called in sequence of request

开发者 https://www.devze.com 2023-01-11 05:09 出处:网络
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 u

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 开发者_如何学Gocompletes 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消