Create a global javascript or jQuery variable visible in many pages
<p>I have a js variable with many functions, and I want to create in one of them a global variable visible in another php file that load the js file.</p>

<p>How can I do that ? </p>

<p>Thanks for help.</p>

<p>Thaks for help : here's an edit : </p>

<p>The variable has a dynamic value and is generated <code>on event.keyCode</code> I have tried in my js file: 
<code>window.selected_sku = null;</code> in the top of the js file</p>

<p>and in the appropriate function :</p>

<pre><code>window.selected_sku =  v;
</code></pre>

<p>In my php within javascript code, I have : </p>

<pre><code>    if(window.selected_sku!=null){
        alert(window.selected_sku);
    }   
</code></pre>

<p>but I don't get any alert !!</p>

<p>Help..</p>
