I have the following code:
var sLat = "test"; //global var, set outside any function
...
geocoder.geocode({
    'address': address
}, function (results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        alert(sLat); //SHOWS test, THATS OK
        sLat = "test2"; //TRYING TO CHANGE ITS VALUE
    } else {
        alert('Geocode was not successful for the following reason: ' + status);
    }
});
alert(sLat); // SHOWS test INSTEAD OF test2
The problem is that the var is accessible inside the callback function but when I try to change its value, the new value ("test2") isn't saved. Whats the problem?
 
     
    