I have some javascript code in the most of my php files(different javascript code in each file but maybe some functions are also used in more than one files) Is it a good idea to put all the javascript code from all of my pages into one file and just include this file in each page(using the include php function)? Thank you in advance!
I have some javascript code in the most of my php files(different javascript code
Share
Yes, you want to separate your JavaScript from your PHP. However, you don’t want to use the PHP include() function to make use of your scripts. In the head of your DOM, just use a script tag with a src attribute.