使得一些AJAX回调的时候维持秩序的请求 [英] Maintain order of requests when making several ajax callbacks

查看:125
本文介绍了使得一些AJAX回调的时候维持秩序的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遍历几个项目,使一个Ajax请求为他们每个人(使用jQuery)。我希望他们能独立执行,但填充入他们被称为,他们不返回的顺序(因为某些原因一些请求需要的时间多于其他人)的顺序DOM。对这种类型的事情最好的做法有什么建议?

I'm looping through several items and making an ajax request for each of them (using jQuery). I want them to execute independently, but populate into the DOM in the order they were called, not the order they are returned (for some reason some requests are taking longer than others). Any tips on the best practice for this type of thing?

推荐答案

这个问题的答案最终是一个jQuery插件叫做ajaxManager。这也正是我所需要的:

The answer to this ended up being a jQuery plugin called ajaxManager. This did exactly what I needed:

http://www.protofunc.com/scripts/jquery/ajaxManager/

这篇关于使得一些AJAX回调的时候维持秩序的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆