Accessing javascript array from function
<p>Okay, so in my <code>&lt;head&gt;</code> section i have the following:</p>

<pre><code>&lt;script&gt;
    var userDefaultInfo = '&lt;?=$userInfo;?&gt;';
    var jGets = new Array ();
    &lt;?
    if(isset($_GET)) {
        foreach($_GET as $key =&gt; $val)
            echo "jGets[\"$key\"]=\"$val\";\n";
    }
    ?&gt;
&lt;/script&gt;
</code></pre>

<p>Now In my external .JS file, In the $(document).ready() section I can access userDefaultInfo fine, however, I am trying to access jGets, but not directly from there.</p>

<p>in the external .JS file, outside of $(document).ready(); I have the following function:</p>

<pre><code>var sendGET = function () {
    var data = $(this).val();
    var elementName = $(this).attr("name");
    var url = "zephi.php?p=home/support/admin_support.php&amp;"+elementName+"="+data;
    jQuery.each(jGets, function(i, val) {
           alert(val);
        });
    alert(url);
    window.location = url;
}
</code></pre>

<p>When a user changes a  box, this function fires and changes the window location using the  data.  However, I want to add the data in the variable <code>jGets</code>, but I do not seem to be able to reference it at all in there.</p>

<p>Why is this?</p>
