本文介绍了1.(ajaxStart 和ajaxSend)和2.(ajaxStop 和ajaxComplete)有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上就是这个问题(括号很重要)

Basically that's the question (parentheses are important)

推荐答案

.ajaxStart().ajaxStop() 用于 all请求一起ajaxStart第一个同时请求开始时触发,ajaxStop 触发,然后最后同时批处理结束.

.ajaxStart() and .ajaxStop() are for all requests together, ajaxStart fires when the first simultaneous request starts, ajaxStop fires then the last of that simultaneous batch finishes.

假设您一次发出 3 个请求,ajaxStart() 在第一个请求开始时触发,ajaxStop() 在最后一个请求(他们不不一定按顺序完成)回来.

So say you're making 3 requests all at once, ajaxStart() fires when the first starts, ajaxStop() fires when the last one (they don't necessarily finish in order) comes back.

这些事件没有获得任何参数,因为它们是针对一批请求的:

These events don't get any arguments because they're for a batch of requests:

.ajaxStart( handler() )
.ajaxStop( handler() )

.ajaxSend().ajaxComplete() 在发送/完成时每个请求触发一次.这就是为什么这些处理程序被传递参数而全局/批处理程序不是:


.ajaxSend() and .ajaxComplete() fire once per request as they send/complete. This is why these handlers are passed arguments and the global/batch ones are not:

.ajaxSend( handler(event, XMLHttpRequest, ajaxOptions) )
.ajaxComplete( handler(event, XMLHttpRequest, ajaxOptions) )

对于单个文档源,全局 Ajax 事件 API 的部分是您所追求的.

For a single documentation source, the Global Ajax Events section of the API is what you're after.

这篇关于1.(ajaxStart 和ajaxSend)和2.(ajaxStop 和ajaxComplete)有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 07:47