How to prevent document.ajaxstart on a specific selector

My jquery call is given below in the text box. I want to prevent ajaxStart () for this selector

$("#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();
          }
       });
    }
});

I want to prevent the method ajaxStart()in the selector above.

ajaxStart () as below

jQuery(document).ajaxStart(function () {
    //show ajax indicator
    ajaxindicatorstart();
}).ajaxStop(function () {
    //hide ajax indicator
    ajaxindicatorstop();
});

Only to prevent the use of the ajaxStart method, but the whole function works like.

Can anyone help me ...

+4
source share
1 answer

I would suggest to place ajaxindicatorstart();and ajaxindicatorstop();within each separate AJAX request, except for the selector, which you do not want to run.

Example:

$.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();
    }
});
+1
source

All Articles