Can I listen to a specific element on ajaxComplete instead of 'document'?

前端 未结 3 1860
闹比i
闹比i 2020-12-12 02:39

Good morning,

I am using the jQuery ajaxComplete Function and I wonder if it would be possible to use it on a specific element (div)?

Example:



        
3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 03:22

    AjaxComplete method sets a global ajax hadler, which fires whenever any ajax call completed. Ajax requests are not bound to any element, so you can't use ajaxComplete on element. I suggest you to add complete handler directly into your ajax call like

    $.ajax({
        //...your options
        complete: function(){
            //..your complete logic
        }
    });
    

    Best regards. Hope it will help.

提交回复
热议问题