I want to use ajax to use a Google Maps API, but I do not know what it would be like in this case.
This is an example of the Google Maps documentation of how the route should be.
In javascript I have the following:
var waypoint = [];
function ordenLista(){
$.ajax({
url:"https://maps.googleapis.com/maps/api/directions/json",
dataType:"json",
data:{origin:{lat:posActualLat, lng:posActualLng},
destination:{lat:-34.911946, lng:-56.160502},
waypoints: (aca no se como poner) },
});
}
The variable waypoint charges it with several addresses. Ex:
waypoint = ["address1", "address2", "address3", "address4"]; these are the directions by which the route will be marked.
I do not know how to fill the field waypoints:
because my array would go waypoint
and optimize=true
to give me the best route.
If you know how I can do it or have some other way of doing it, I appreciate it.