AjaxComplete not working on $ (window)

I am using jQuery version 1.5.1 and this does not work for me:

$(window).ajaxComplete(function() { console.log('hello'); }); 

but this:

  $(document).ajaxComplete(function() { console.log('hello'); }); 

Why can't I bind an event handler to $(window) ?

Note: this code works with jQuery v1.3.2, but not with v1.5.1

+4
source share
1 answer

Perhaps because window is

1.) Not an item

2.) Somewhat "protected" by the js engine browser

3.) It's a bad idea when you are looking for something to attach an AJAX event to

Why can't you use document or element instead?

+5
source

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


All Articles