I have the following function.
function geocodePosition(pos, inputField) {
var retvalue = "";
geocoder = new google.maps.Geocoder();
geocoder.geocode({latLng: pos}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
retvalue = results[0].formatted_address;
inputField.value = retvalue;
} else {
alert('Cannot determine address at this location status [' + status + "]");
}
});
alert ("retvalue : " + retvalue);
return retvalue;
}
I know that I am missing something fundamental here. But retvalue in the alert Statement is allways blank. How do I set it in the function block of the call to geocode.
Kind regards
Michael