Automatic show ajax loader gif image when any ajax function is called in the application

StackOverflow https://stackoverflow.com/questions/19269027

  •  30-06-2022
  •  | 
  •  

Question

I have many ajax calls in the application which are performing various operations, I am searching for a Jquery plugin or any other method which will detect any ajax call made and show loading image when operation is in process and hide it after operation is complete.Any help is welcome.

Was it helpful?

Solution

Got a solution for this , I used Pretty Loader and my problem is solved .

OTHER TIPS

$( document ).ajaxStart(function() {
    ShowLoading(1);
});
$( document ).ajaxComplete(function() {
    ShowLoading(0);
});
$.ajax({
    url: "test.html",
    context: document.body
}).beforeSend(function() {
    /* show loader */
}).success(function(){
    /* hide loader */
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top