我怎么知道是否jQuery有一个Ajax请求未决? [英] How do I know if jQuery has an Ajax request pending?

查看:126
本文介绍了我怎么知道是否jQuery有一个Ajax请求未决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题,jQuery的控制,我们做。假设你有一个DropDownList,允许你输入你要查找的物品的ID,当你preSS ENTER或它通过jQuery验证您所输入的ID是正确的文本框失去焦点,显示警报如果事实并非如此。

I'm having some problems with a jQuery control we made. Suppose you have a dropdownlist that allows you to enter the ID of the item you're looking for, and when you press ENTER or lose focus in a textbox it validates via jQuery that the ID you entered is correct, showing an alert if it doesn't.

的事情是,当一个普通用户在这一个无效的值和$ P $失去焦点pssing提交按钮后,该表单的提交jQuery的回报后已发送。

The thing is that when an ordinary user enters an invalid value in it and loses focus by pressing the submit button, the jQuery post returns after the submit of the form has been sent.

有没有什么办法,我可以检查是否有的jQuery任何异步请求处理,这样我不允许的形式提交?

Is there any way that I can check if there's any Async request processing by jQuery so that I do not allow the form submit?

推荐答案

您可以使用 ajaxStart 和的ajaxStop 跟踪时,活动的请求的。

You could use ajaxStart and ajaxStop to keep track of when requests are active.

这篇关于我怎么知道是否jQuery有一个Ajax请求未决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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