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

Asked

Viewed 121 times

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 the page ajax requests finish loading, the $.ajaxStop serves for this, a "default" for all the document requests. But I have a single ajax call where I don’t want the $.unblockUI to run... there’s some way to make it happen only on that request?

  • You customised the ajax calls in your application and within ajaxStop you added the code to close the modal. Is that it? If it is, put the customization.

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 meuAJAX indicating true/false for modal.

Following example: link

Browser other questions tagged

You are not signed in. Login or sign up in order to post.