Access places response properly

This commit is contained in:
Jonny Barnes 2016-10-03 16:36:42 +01:00
parent c8890f3033
commit 3dbae679ac

View file

@ -28,11 +28,11 @@ function addPlacesMap(latitude, longitude, uncertainty) {
alertify.reset(); alertify.reset();
alertify.error(j.error_description); alertify.error(j.error_description);
} }
if (j.length > 0) { if (j.places.length > 0) {
var i; var i;
var places = []; var places = [];
for (i = 0; i < j.places.length; ++i) { for (i = 0; i < j.places.length; ++i) {
var latlng = parseLocation(j[i].location); var latlng = parseLocation(j.places[i].location);
var name = j.places[i].name; var name = j.places[i].name;
var slug = j.places[i].slug; var slug = j.places[i].slug;
places.push([name, slug, latlng[0], latlng[1]]); places.push([name, slug, latlng[0], latlng[1]]);