I am including header.php and footer.php in each of my page and I am loading the remaining contents of each page via ajax. My jquery codes are at footer.php. Now on initial load everything seems fine but whenever I navigate to the next page the jquery codes are not working. They do work if I include them in the body of each page but that however increases page load time. Also I donot need all the jquery for one page. How to call jquery dynamically according to page url?
Use jQuery .on() to define click events :
ex :
$(document).on( eventName, selector, function(){ } );
or
define Click Events in the html, you get from ajax.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.