Is it possible to pass a variable to a linked .js file? I tried this:
No, you can't pass parameters like that and have the script read them in.
Technically you could grab them from the <script>
tag, but that would be a real mess.
Could you just output a script block before you include the file?
<script type="text/javascript"> var timeout = 1000; </script>
<script type="text/javascript">
var imagesPath = "emblematiq/img/";
</script>
<script type="text/javascript" src="emblematiq/niceforms.js"></script>
This will work fine on server
try this:
<script>
var myvariable = "foo";
</script>
<script src="/link/to/js.js"></script>
No, but you can pass a the value directly to a function in that file or set a variable value that will be used in the external file.