How to add polylines with an array of position?
问题 I have a simple array containing name of cities. I'm trying to loop through this array and add markers linked by Polylines on the Google Map. Here is my code: function addMarkerCity(cities) { $.each(cities, function(index, value) { geocoder.geocode({'address': value}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var cityPosition = results[0].geometry.location; flightRoute.push(cityPosition); var currentMarker = map.addMarker({ position: cityPosition }); }); }); }