jQuery.get() Variables Scope
<p>I'm working with jQuery's Ajax but in my case I need to store the response in global variables:</p>

<pre><code>var points = Array()
$.get("/data", {"id": 1}, function(data) {
    for (var i=0; i &lt; data.length; i++) {
        points[data[i].someid] = data[i];
    }
alert(points[22].someid.toString()); // it works fine
});

alert(points[22].someid.toString()); // undefined
</code></pre>

<p>However when I try to access the variable points outside of the scope of $.get() I just get an undefined object. But I get the right object inside $.get().</p>

<p>What's the best way/standard to manage context and scope in this case?</p>
