So , I don’t know what is wrong with this code , help needed.
I want the user to enter the start , waypoints and ending address.
var start = document.getElementById('start').value;
var way = document.getElementById('way').value;
var end = document.getElementById('end').value;
var request =
{
origin: start,
destination: end,
waypoints: way,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
……………………………………………………………………
<strong>Start:</strong>
<input id="start" type="text" ></input>
<strong>Waypoint:</strong>
<input id="way" type="text" ></input>
<strong>End:</strong>
<input id="end" type="text" ></input>
Don’t seem to understand where I am getting it wrong and thanks in advance for an explanation.
Waypoints are an array of DirectionsWaypoint objects. These objects contain a LatLng object or address string and a Boolean stopover property.
Try this:
here is a Google Sample App working with waypoints.