All,
I have the following array called locations returned by a PHP ajax call to Javascript
["41.8818907,-87.6415806",
"41.8819918,-87.6416019",
"0.0,0.0",
"41.8816614,-87.6417209"]
How do I loop through these values in Javascript and create an array of markers for google maps?
Ex:
function generateMarkers(locations) {
for (var i = 0; i < locations.length; i++) {
new google.maps.Marker({
position: new google.maps.LatLng(locations[i][0], locations[i][1]),
map: map,
title: locations[i][0]
});
}
}
Thanks