我的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方法,但整个功能与...一样。
任何人都可以帮助我......
答案 0 :(得分:1)
我建议将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();
}
});