Using global variable outiside document ready javascript?
<p>looking trough this site I have seen a number of suggestions about how to update a global variable inside document ready, and then use it outside document ready.  I have tried a number of combinations of these and none of these seem to work.  Any help?  What am I missing?</p>

<pre><code>test = 0 ;
</code></pre>

<p>or</p>

<pre><code>var test = 0;
</code></pre>

<p>or</p>

<pre><code>test;
</code></pre>

<p>or</p>

<pre><code>var test;
</code></pre>

<p>or no declaration outside document ready at all</p>

<p>then</p>

<pre><code>    $(document).ready(function(){
  test = 4;
});
</code></pre>

<p>then later...</p>

<pre><code>alert(test);
</code></pre>

<p>output:0, or undefined.  Why oh why don't you output 4 like I want you to!  I know, I wish I could just use a normal fucntion where this works easily, but I can't.  I need to use document ready to get some json/jplot material to work.  Thanks!</p>
