Skip to content

Instantly share code, notes, and snippets.

@basselin
Last active August 29, 2015 14:13
Show Gist options
  • Save basselin/d17c89cf51aad76dbca2 to your computer and use it in GitHub Desktop.
Save basselin/d17c89cf51aad76dbca2 to your computer and use it in GitHub Desktop.
var gMapsApi = window.google.maps;
var map = new gMapsApi.Map(/*...*/);
var geocoder = new gMapsApi.Geocoder();
geocoder.geocode({ address:$('[name="q"]').val() }, function(results, status) {
if(status == gMapsApi.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
} else {
console.log('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