title: Get value of a variable in another page using jquery
body: <p>am really struck here. Actually the problem is, i have 2 web pages name as menu.html &amp; index.html. in menu.html i have 3 buttons like "one,two,three", when i click any of a button it'll redirect to index.html. so, i wrote a common.js file for getting value of what button i clicked in menu.html. i have included common.js into both menu.html &amp; index.html. </p>
  
  <p><strong>common.js :</strong> </p>
  
  <pre><code>var text=" ";
  $(document).ready(function() {
      $('input:button').click(function() {
          text = $(this).val();
          alert(text); //here am getting correct values for a button like 'one,two or three' in menu.html page
          });
  }); 
  </code></pre>
  
  <p>now i need to get the value of "text" in another.js file which is in index.html.</p>
  
  <p><strong>another.js:</strong></p>
  
  <pre><code>$(document).ready(function() {
      alert("text "+text); //here am getting empty value.
  });
  </code></pre>
  
  <p>moreover i included correctly in index.html : </p>
  
  <pre><code>&lt;script src="common.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="another.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>what am doing wrong here? thank u in advance.</p>