Php vars within javascript
<p>I have a bit of code to record a certain action</p>

<pre><code>$('#record').click(function(){
$.get("../confirm.php", { "id": '&lt;?php echo $record; ?&gt;' }, function(data){});
});
</code></pre>

<p>Which works fine, but i don't want the page to be full of javascript and such as i have other things like this on it too, so i am trying to move it to a js file.</p>

<p>In the php file</p>

<pre><code>&lt;script type="text/javascript"&gt;var record = "&lt;?= $record ?&gt;";&lt;/script&gt;
&lt;script type="text/javascript" src="jsfile.js"&gt;&lt;/script&gt;
</code></pre>

<p>In the js file</p>

<pre><code>$('#record').click(function(){
$.get("../confirm.php", { id: record}, function(data){});
});
</code></pre>

<p>But it doesnt want to play ball, any ideas how to do this?</p>
