Hello Stackoverflow Users,
I hope you can help, basically say I have a PHP File with a variable, lets say domain.com/forum/myname.php - In that myname.php file is:
$myname = "jake";
Now, I have a JS File at domain.com/forum/js/template.js
How would I get this PHP Variable into the JS File? I know once I have the PHP Variable I could do
var string = $myname;
and then use string wherever I want it to display, but the matter is how do I transfer it from PHP to the JS File?
I have seen other questions relating to this, but not one offers a clear explanation on how to do it?
Thanks.