> getDrivingTime function (Start, End, responseHandler) { > .... > directionsService.route (request, function (response, status) {
That fires off a directions request to Google and returns immediately to your code. > getDrivingTime (Start, End, function (time) { > time = time/100; So the 'time=..' line is executed immedately, long before the directions get back from Google. If you want to use the data, you must use it in the callback function as that is the only way to be sure it has arrived. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api...@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.