Execute after ajax is complete — without accessing the ajax function?

  Kiến thức lập trình

I need to perform a JS function after an ajax function is complete (filtering posts in WordPress). However, the ajax filter tool is created by a WordPress plugin that I can’t edit. How can I detect that a particular ajax call has finished when I didn’t create the ajax function?

For example (I know this isn’t correct, but trying to show what I want to do):

  $(document).on("AJAX HAS FINISHED", function(){
        console.log("ajax complete");
        activatePopup();
  });

Can this be done?

LEAVE A COMMENT