I have tried different variable scopes and none seem to work? My callback is getting a valid result but no matter the scope of the variable I assign it to I lose the value once the callback ends??
var geocoder;
var Lat;
var Long;
function codeAddress()
{
var geocoder = new google.maps.Geocoder();
var addy1......
geocoder.geocode({ 'address': fullAddress }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
Lat = results[0].geometry.location.lat();
Long = results[0].geometry.location.lng();
}
else
{
alert("Geocode was not successful for the following reason: " + status);
}
});
alert(Lat);
document.getElementById("Address_AddyLat").type.value = Lat;
document.getElementById("Address_AddyLong").value = Long;
}
Thank for your input.