How to avoid the function of the ajaxStop () method in a single ajax call?

0

I have the following problem:

There is a page where I use $ .ajaxStop to give a $ .unblockUI (modal plugin), this closes the modal "loading ..." whenever ajax page requests finish loading, $ .ajaxStop serves as a "standard" for all document requests. But I have a single ajax call where I do not want $ .unblockUI to run ... is there any way to make it happen on that request alone?

    
asked by anonymous 21.07.2016 / 14:05

1 answer

1

You can create a plugin in jquery more or less like this:

$.fn.meuAJAX = function(){
    var url = arguments[0];
    var dados = arguments[1];
    var callback = arguments[2];

    $.post(url,dados,callback);
}

$(document).ready(function(){
  $(this).meuAJAX('/echo/json/',{data:'teste'},function(data){
    console.log(data)
  });
});

You can send an additional argument to myAJAX indicating true / false for modal.

Here's an example: link

    
01.08.2016 / 21:30