PHP to set JS variable outside of JS file
(it has to be set by PHP depending on some calculations)
How is the best way to do this as I don;t like the below method?
I have heard of setting the value in a hidden text field, but I like the idea of setting something like this:
the_value = "<?php echo $the_value; ?>";
...where I can then use the unobtrusive JS to grab the value.
<meta id="the_value" content="1">
Is that possible?
What is the best way to do this?