Skip to content

Instantly share code, notes, and snippets.

@Tobur
Created November 12, 2013 13:48
Show Gist options
  • Save Tobur/7431086 to your computer and use it in GitHub Desktop.
Save Tobur/7431086 to your computer and use it in GitHub Desktop.
var geocoder = new google.maps.Geocoder();
geocoder.geocode({"address":$('#'+settings.findInputId).val()}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var lat = results[0].geometry.location.lat(),
lng = results[0].geometry.location.lng(),
placeName = results[0].address_components[0].long_name,
latlng = new google.maps.LatLng(lat, lng);
marker.setPosition(latlng);
infowindow.setContent(placeName);
infowindow.open(self.map, marker);
console.info(results);
//$("#"+settings.findInputId).val(addressText);
//self.data = {'address': results[0].address_components, 'geometry':results[0].geometry};
//executeSearch(self.data);
} else {
self.showError(Translator.get('select.from.drop.down.list'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment