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

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

  •  30-06-2022
  •  | 
  •  

Вопрос

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.

Это было полезно?

Решение

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

Другие советы

$( 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 */
});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top