0

I am using WordPress with the events calendar plugin. I have written some JavaScript to manipulate the DOM on the view that publishes the courses in a grid. The code works fine until the user paginates. Looking at the dev tools, I can see a xhr request, so can assume the pagination happens via ajax.

How do I make sure the code works when the user paginates? I have tried using the jQuery ajax.Complete event.

All my code is wrapped in one function called

courseElements();

Thanks

John Paul
  • 87
  • 1
  • 8
  • If you have not yet looked at the documentation for your plugin and asked the plugin developer for support, you should do so. Without specific plugin knowledge you'll need the devtools Javascript debugger to figure out which exact event to use to invoke your js. – O. Jones Jun 06 '23 at 13:08

1 Answers1

0

Reviewing the code for a specific event to use is best (as mentioned by O. Jones).

If there is no such event, then you may be able to use the readystatechange event, as described here: How to run a function when any XMLHttpRequest is complete?.

Caleb
  • 1,058
  • 1
  • 7
  • 18