Let's say i have a variable in a php-file (index.php):
$PHP_variable = "string";
And i want to pass it to my JS file (functions.js) that's currently being read within the php-file. Is that possible?
For example, i have this in my php-file:
<input type="text" name="textfield" value="'.$PHP_variable.'" />
<input type="button" id="actionButton" />
And in the js-file:
$('#actionButton').click(function(){
alert(THE_PHP_VARIABLE);
});
How is it possible to pass $PHP_variable to the js file? I'd prefer not to use the js code directly on the php-script (i know how to solve it that way).