I have a textbox in my page which gets a location name and button with text getLat&Long
. Now on clicking my button I have to show an alert of latitude
The below is the code that i used. It's working perfectly.
var geo = new google.maps.Geocoder;
geo.geocode({'address':address},function(results, status){
if (status == google.maps.GeocoderStatus.OK) {
var myLatLng = results[0].geometry.location;
// Add some code to work with myLatLng
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
Hope this will help.