If you have certain functions or variables you need to have always available and globally accessed, put them in a shared .js file that is included on every page. This is a great way to handle some basic Ajax calls and some other shared code that is used frequently.
If you have forms that have custom requirements before submitting, include that code right in the PHP file you’re working on as a part of the visual part of your command structure. This will make debugging easier and you can dynamically generate that form verification based on logic that PHP knows about (such as which form elements should or should not be included based on various conditions).
Michael Berding August 28th, 2013
Posted In: Basics