Jquery access data globally, pushing it into an object
<p>I have a function that is pulling in data with an AJAX call.  I am creating an object that I would like to access in other functions.  So I would like to send the data into another global object.  </p>

<p>Here is the currently javascript:</p>

<pre><code>var foursquareMapData = [];

function MapData() {

    $.ajax({
        dataType: 'jsonp',
        url: 'https://s3.amazonaws.com/sxsw_trending/sxsw_trending.json',
        jsonp: "callback",
        jsonpCallback: "sxswTrending",
        success: function (data) {
            //console.log(data);
            // var foursquareMapData = [];
            for (var i = 0; i &lt; data.Trending.length; i++) {

                var mapData = {
                    index: i + 1,
                    lat: data.Trending[i].lat,
                    lng: data.Trending[i].lng,
                    count: data.Trending[i].hereNow,
                    address: data.Trending[i].address
                }
                //console.log(mapData);
                foursquareMapData.push(mapData);
            }
            //console.log(foursquareMapData);
        }
    });

}
console.log(foursquareMapData);
</code></pre>

<p>Pushing the 'mapData' object into the foursqureMaData doesn't seem to working.  I might not be doing this properly?</p>
