Javascript variable not working in a different file
<p>I have this script in <strong>index.php</strong> file:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $('#ads').load('output.php').fadeIn('slow');
});
&lt;/script&gt;
</code></pre>

<p>And the <strong>output.php</strong> file contains a hidden input by which I pass a php variable and retrieve it succesfully:</p>

<pre><code>&lt;script type="text/javascript"&gt;
num = document.getElementById('number').value;
&lt;/script&gt;
</code></pre>

<p>And if I put, say, an <code>alert(num);</code> in the <strong>output.php</strong> file, everything works. Though when I do the same in the <strong>index.php</strong> file, javascript doesn't seem to see that <code>num</code> variable.</p>
