admin管理员组文章数量:1331659
Prototype stores the number of active AJAX requests in Ajax.activeRequestCount
. Is there something similar in jQuery/Mootools etc or something that can be used from XMLHttpRequest?. Ideally I need a library independent method of detecting the number of active AJAX requests within a page. If not, a method for each library would suffice.
Prototype stores the number of active AJAX requests in Ajax.activeRequestCount
. Is there something similar in jQuery/Mootools etc or something that can be used from XMLHttpRequest?. Ideally I need a library independent method of detecting the number of active AJAX requests within a page. If not, a method for each library would suffice.
4 Answers
Reset to default 2Prototype only keeps track of the number of active requests made using Prototype APIs. If you were to make an AJAX request using any other method, Ajax.activeRequestCount
will not be affected. There is no cross-library way to keep track of every request made, unless you were to keep track of them yourself.
$.active
for jQuery, as I see from the documentation
MooTools doesn't seem to have one (here's the Request class source)
Perhaps for MooTools you could make an intermediary function to call Ajax, and make your own count there?
Mootools request objects are initiallized once and resused, you can keep count when initializing.
BTW, I bet that the reson you want to keep this counted is not a requirement with mootools, due to its single instance structure, look into it!
jQuery has an (undocumented?) ajax active counter: jQuery.active
Roger Hu has a blog post about it.
本文标签: javascriptActive AJAX requestsStack Overflow
版权声明:本文标题:javascript - Active AJAX requests - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742270526a2444219.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论