I have a php function returning an array of map coordinates.
I am then trying to place them on a google map using
for (var i=0; i<coords.length; i++) {
var via = new google.maps.LatLng(coords[i][1], coords[i][2]);
};
where via is lat and longs, and coords[i][1], coords[i][2] are pulled from a php array.
This method only writes the last value of the array onto the map when the function runs, i need it to produce the entire array.
Secondly i need to pull only the last value of the array and drop it into the variable "end" when the array is done its loop.
**** also have tried
var via = [];
for (var i=0; i<coords.length; i++) {
via.push([new google.maps.LatLng(coords[i][1], coords[i][2])]);
};
and
var via = [];
for (var i=0; i<coords.length; i++) {
var viaPoints = new google.maps.LatLng(coords[i][1], coords[i][2]);
via.push([viaPoints]);
};