Thank you for your answer. I will change my code to work. But, is possible stop de code until the callback function is called to save de date?
On 28 ago, 17:43, Rossko <[email protected]> wrote: > > How can I return "drivingDistanceKilometers" after event load to not > > be undefined? > > You can't. The function is a callback function for an asynchronous > service. When you call an asynchronous service, you only fire off the > request and the rest of your code continues executing. Eventually the > data comes back, and the callback function that you defined runs, but > it cannot 'return' to anywhere in your code. > > If you want to do something with 'drivingDistanceKilometers', you must > do it within the callback function. -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
