Hello,
I have the following problem: I wrote a function that converts
coordinates into formatted address via geocode and I put the code in a
function (in way to reutilise that).
*************************
function coordinates2Address(latLng)
{
var geocoder;
var codedAddress;
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latLng},
function(results, status)
{
if (status ==
google.maps.GeocoderStatus.OK)
{
if (results[1])
{
codedAddress =
results[1].formatted_address;
alert(codedAddress);
}
else
{
codedAddress = "No
data";
}
return codedAddress;
}
else
{
alert("Geocoder failed due to:
" + status);
}
});
}
*********************
If I print the value with an alert, it works. If I print the result by
a jQuery append (by appending the value returned) no dat is showing,
but only the text "undefined".
Why?
Thanks.
--
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.