La versione V3 che ho scritto è la seguente:
var coordinate;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
coordinate = (results[0].geometry.location)
} else {
alert("Geocode was not successful for the following reason: " + status);
}
})
il problema è che pur definendo la variabile coordinate fuori dalla funzione (e quindi come globale) quando la utilizzo fuori dal geocoder me la segna sempre come undefined... non capisco il perchè..