如何防止特定选择器上的document.ajaxstart

用户名

我的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方法,但整个功能按原样运行。

有谁能够帮助我...

NightOwlPrgmr

我建议除了将不想启动的选择器之外,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();
    }
});

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章