I have a loading div or loader that should show up during Ajax Requests.
$('#loadingDiv').ajaxStart(function () {
$(this).show();
}).ajaxComplete(function () {
$(this).hide();
});
I want the loader to show up during all Ajax Requests, but prevent it on a particular request.
I tried the following:
$.ajax({
url: 'Handler.ashx',
success: function (msg, status, xhr) {
$('#loadingDiv').hide();
}.....
But the div shows up then disappears, I don't want it to show up at all.
Set global
to false when making the request:
$.ajax({
url: 'Handler.ashx',
global: false,
...
});
See the Ajax.Events docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With