Skip to content

Instantly share code, notes, and snippets.

@Trindaz
Created June 5, 2012 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Trindaz/2878326 to your computer and use it in GitHub Desktop.
Save Trindaz/2878326 to your computer and use it in GitHub Desktop.
function codeAddress(){
var geocoder,latLng;
geocoder = new google.maps.Geocoder();
var address = document.getElementById('address').value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
latLng=results[0].geometry.location;
document.getElementById("address").value = latLng;
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment