dshrenik
asked on
Return a value
I'm using Google Maps API to do this
However, I need to return a value from the function getDist(). Please let me know how I can do this. Thanks!
function getDist() {
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [origin1, origin2],
destinations: [destinationA, destinationB],
travelMode: google.maps.TravelMode.DRIVING,
avoidHighways: false,
avoidTolls: false
}, callback);
}
function callback(response, status) {
// See Parsing the Results for
// the basics of a callback function.
}
However, I need to return a value from the function getDist(). Please let me know how I can do this. Thanks!
ASKER
I am using the Google Maps API to calculate driving distance.
ASKER
I have the code that calculates the distance. Its just that I want to return the value rather than just printing it or displaying it in an alert.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Math.sqrt((desA-Origin1)*(
whatever the result is your direct distance.
the formula is use in this is the line equation.....
Regards,
nishant