我的jquery调用在文本框上如下所示,我希望防止这个选择器上的ajaxStart()
$("#ddl_select").keyup(function() {
var searchid = $(this).val();
var dataString = 'search='+ searchid;
if(searchid!='') {
$.ajax({
type: "POST",
url: "searchname.php",
data: dataString,
cache: false,
success: function(html) {
$("#result").html(html).show();
}
});
}
});
我想在上面的选择器中防止ajaxStart()
方法。
ajaxStart()代码如下
jQuery(document).ajaxStart(function () {
//show ajax indicator
ajaxindicatorstart();
}).ajaxStop(function () {
//hide ajax indicator
ajaxindicatorstop();
});
只防止ajaxStart方法,但是整个函数的工作原理是一样的。
有人能帮我..。
发布于 2015-06-20 04:13:13
我建议将ajaxindicatorstart();
和ajaxindicatorstop();
放入每个单独的AJAX请求中,但不希望启动它的选择器除外。
示例:
$.ajax({
type: "POST",
url: "searchname.php",
data: dataString,
cache: false,
beforeSend: function() {
// start the indicator right before the AJAX call fires
ajaxindicatorstart();
},
success: function(html)
{
// stop the indicator and show the result
ajaxindicatorstop();
$("#result").html(html).show();
}
});
https://stackoverflow.com/questions/30950051
复制相似问题