I am using javascript for the first time.Actually i want to get the latitude and longitude of an address using java script.Can anyone guide me..
If you need latitude and longitude of a given adress, you can use google maps api https://developers.google.com/maps/documentation/javascript/
Here is an example: https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple
EDIT: to display it in an alert popup:
var address = document.getElementById("address").value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
var location = results[0].geometry.location;
alert(location.lat() + '' + location.lng());
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With