Because geocoding is asynchronous.

The geocode request gets sent, but then processing immediately continues 
and your alert(theEnd2) gets performed.

Some time later, a reply comes back from the geocode server and your 
callback function is executed. It places the value in theEnd2, but it's 
too late to affect the alert.

What you have to do is call all the processing that requires the 
geocoder result from inside the callback function.

See: http://econym.org.uk/gmap/async.htm

-- 
Mike Williams
http://econym.org.uk/gmap



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to