Hello,
I'm new to Google Maps and today i tried to make a simple map. I
followed tutorial and all went well, so i decided to implement maps
into my webpage. Long story short, the example function codeAddress()
can'r return the "results[0].geometry.location" data or (and that's
more probable) I do something wrote. Here's the code:
function codeAddress(adresa) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': adresa}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK) {
return results[0].geometry.location;
} else {
alert("Geocode was not successful for the following reason: "
+ status);
}
});
}
var loc = codeAddress('Sydney');
document.write(loc);
It outputs just text "undefined". But when I output it to a html
element (in that function) it works.
I don't know Javascript very well, so I'd like to ask you, what's
wrong.
Thanks a lot
--
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 [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-js-api-v3?hl=en.