So I'm making a Google Maps based webapp in JavaScript and a part of my code looks like this:
function revGeocode(marker){
var latlng = marker.position;
if (geocoder) {
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
return "GOOD";
} else {
alert("No results found");
return "BLAH1";
}
} else {
alert("Geocoder failed due to: " + status);
return "BLAH2";
}
});
}
else{
return "No Geocoder?!"
}
return "Weird..";
}
Now, for some reason it's skipping both the IF and ELSE conditions and jumping to the final return (which I just added to see why it wasn't catching both conditions). Anyone know why this is happening?