This is a clarification and advice question. From building an application I have come to refactor much of my jQuery from the <head>
tags into its own .js files. My contention is that I'm using constants to define paths.
Therefore if I refactor code that needs those PHP constants then the jQuery code will not work, because as far as I know I cannot include the init.php file that contains the constants. Am I mistaken? is there a way to include the needed Constants within my jQuery files for code such as the type below:
$.ajax({
type: "POST",
url: "<?php echo SITE_PATH; ?>file.php"
});
The above code is a snippet from a jQuery AJAX POST, which works fine within my head. But if I was to refactor the code to its own JS file how would I go about getting access to the desired constants and using them within JS?
Any thoughts would be appreciated.