0

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 and longitude of the location in the textbox. Any suggestion?
please dont give me suggestion as googleapis b'coz its some stage limitations after this limit want to pay for this. this is my try with googleapis:-

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
 <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function myIP(){
$("#btn").click(function(){
            var geocoder =  new google.maps.Geocoder();
    geocoder.geocode( { 'address': '#city'}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            alert("location : " + results[0].geometry.location.lat() + " " +results[0].geometry.location.lng()); 
          } else {
            alert("Something got wrong " + status);
          }
        });
});
}
 </script>
</head>
<body onload="myIP()">
<input type="text" id= "city">
<input id="btn" type="button" value="get Lat&Long" />
</body>
</html>

thanks.

timss
  • 9,982
  • 4
  • 34
  • 56
Jack Php
  • 577
  • 2
  • 7
  • 25

1 Answers1

-1

Getting the latitude and longitude from an address or location name (Geocoding) is complicated, so a third party service like google api is going to be needed.

Rodrigo5244
  • 5,145
  • 2
  • 25
  • 36