Ajax not working on deferred jQuery
-
Hello,
If jQuery is deferred, it’s not defined during the page load, which means the plugin will throw an error (“jQuery is not defined!”).
I managed to add a quick hack for the code to work just by surrounding the code with a DOMContentLoaded listener:
window.addEventListener('DOMContentLoaded', function() { //plugin js });
This ensures the script runs after the DOM is loaded (which means deferred scripts were already executed). This is required to minimize render-blocking javascript.
I’m wondering if it’s possible to add a similar fix into a future version.
Thanks!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Ajax not working on deferred jQuery’ is closed to new replies.