如何检测 ajax 调用的开始?

发布于 2024-09-18 10:01:01 字数 132 浏览 2 评论 0原文

在JQtouch中,任何链接都会自动转换为ajax调用。我想检测 ajax 调用发送的时刻。这样我就可以插入一个加载屏幕,让用户知道系统正在处理提交。

我搜索 jqTouch API ,显然他们只有页面动画的回调事件。我错过了什么吗?

In JQtouch, any link is automatically convert into ajax call. I want to detect the moment the ajax call was send. This is so that i could insert a loading screen to let users know that the system is processing the submission.

I search through jqTouch API and apparently they only have callback events for page animation. Am i missing out on anything?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

混浊又暗下来 2024-09-25 10:01:01

您可以使用核心 jQuery 全局 AJAX 函数,例如 $.ajaxStart() 用于启动一批请求,或 $.ajaxSend() 检测每个请求的开始。像这样的东西:

$(document).ajaxSend(function() {
  alert("Request sending...");
});

You can use the core jQuery global AJAX functions, for example $.ajaxStart() for the start of a batch of requests, or $.ajaxSend() to detect the beginning of each request. Something like this:

$(document).ajaxSend(function() {
  alert("Request sending...");
});
深居我梦 2024-09-25 10:01:01

准备好 jQuery 的 Ajax 事件:http://docs.jquery.com/Ajax_Events< /a> .

您可以将它们绑定到元素,如下所示:

$("...").bind("ajaxSend",myFunction) ;

以这种方式指定的每个元素都会对使用指定回调函数进行的 Ajax 调用做出反应。

Ready up on jQuery's Ajax Events: http://docs.jquery.com/Ajax_Events .

You may bind these to elements as follows:

$("...").bind("ajaxSend",myFunction) ;

every element specified this way will then react to a Ajax call being made with the specified callback function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文