Hide spinner only for specific ajax
I am using a spinner using tutorial shown here
there are 3 functions running ajax calls I want to hide it for only a specific function running ajax call, how to do this ?
Currently my code for adding spinner for ajax call is this :
$(document).ready(function(){
$("#spinner").bind("ajaxSend", function() {
$(this).show();
}).bind("ajaxStop", function() {
$(this).hide();
}).bind("ajaxError", function() {
$(this).hide();
});
});
its exactly what is shown in the tutorial which I've linked above. Now how do I make it work only for 2 ajax calling functions开发者_如何学Python out of 3 ?
ps : Should I unbind it and bind it everytime ??
for an ajax-call that doesn't use ajaxStart/ajaxStop (which is what you're using to show/hide your spinkner i think, theres no information about that in your question) just set global: false
like this:
$.ajax({
url: "test.php",
context: document.body,
global: false,
success: function(data){
$('#test').html(data);
});
for more information, take a look at the documentation.
精彩评论