I am trying to get map coordinates of business listing from a JSON file that I have. The json is working correctly, but the coordinates are not being saved to my array. The array always returns empty. What am I doing wrong?
var locations = new Array();
var contents = new Array();
$.getJSON('listings/json', function(data) {
$.each(data, function(i, listing) {
var loc = new Array(listing.latitude, listing.longitude);
locations.push(loc);
contents.push('<div class="infobox"><div class="infobox-header"><h3 class="infobox-title"><a href="#">' + listing.listing_title + '</a></h3><h4 class="infobox-subtitle"><a href="#">Manhattan 5, NYC</a></h4></div><div class="infobox-picture"><a href="#"><img src="' + listing.preview_path + '" alt=""></a><div class="infobox-price">$ 2,000</div></div></div>');
});
});
I get this problem with both the locations array and the contents array. Any ideas?