Say I have someJavascript.js file and somePHP.phpfile. In my php file, I have some $foo. How do I set a var something = $foo if it's in a different file?
Things I tried:
var something = '<?php echo $foo ?>';- This just gave me a string of exactly that phrase.var something = '<?php echo json_encode($foo); ?>';Same thing, just a string.
Any help would be greatly appreciated! Thanks.