JQuery ajaxComplete () detect ajax prototypejs calls?

(function($){
    $(document).ready(function(){   
      $(document).ajaxComplete(function() {
         console.log("finished")
      });
    });
})(jQuery);

this does not work after calling the prototype on the page.

But this prototype code works:

Ajax.Responders.register({
  onCreate: function() {
    console.log("start")
  },
  onComplete: function() {
    console.log("finished")
  }
});

There were problems with ajaxcomplete earlier, when several jquery libraries were loaded on the page, but now it is not.

Does jQuery ajaxComplete () detect prototypes of ajax calls?

Thanks!

+4
source share
1 answer

Short answer: no

Long answer: since jQuery and PrototypeJS abstract the basic XHR functionality in different ways, they track the number of active XHR requests in their own way and run their own callbacks.

, PrototypeJS activeRequestCount , ajax

Ajax.Responders.register({
  onCreate:   function() { Ajax.activeRequestCount++ },
  onComplete: function() { Ajax.activeRequestCount-- }
});
+4

Source: https://habr.com/ru/post/1623416/


All Articles