I'm using the Rain.tpl templating engine for my website. I now have a variable ($username) which I can use in my regular html file with {$username}
. This works fine.
I now want to use this same variable in a separate .js file which I load into the thml file using <script src="/js/MySeparateJsFile.js"></script>
. I tried using {$username}
in it, but that doesn't seem to work. So I thought of setting it from within the html file using Javascript, but I have no clue how I would be able to do that.
Does anybody know how I can insert a javascript variable from within an html file into the .js file methods? All tips are welcome!