I need to pass a variable that php is aware of to my javascript code and I'm wondering what the correct way to do this is.
I already know that I could add this to the page generation:
<script type="text/javascript">
var someJSVariable = <?php echo $somePHPVariable ?>
</script>
But I find this method to be more obtrusive than I'd like. I am wondering if there is a better way to do this, or am I stuck with having to just inject inline javascript code in to the view script?