Passing PHP variables to non-native JavaScript
<p>Basically, the problem is this: </p>

<pre><code>&lt;?php $test="foobar"; ?&gt;
</code></pre>

<p>If within the html document I call</p>

<p><code>&lt;script type="text/javascript"&gt;alert("&lt;?php echo $test; ?&gt;")&lt;/script&gt;</code></p>

<p>, everything is fine.</p>

<p>However, if I do the same thing in an external jS document included with </p>

<pre><code>&lt;script type="text/javascript" src="foo.js"&gt;&lt;/script&gt; 
</code></pre>

<p>it does not work. </p>

<p>Is there any way to do this? </p>
