This code is showing auto complete addresses, but I want to show them on a map.
I want to add Google maps on my asp.net page by taking the From and To address from the auto complete text boxes.
Please Help me.
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function () {
var places = new google.maps.places.Autocomplete(document.getElementById('txtPlaces'));
var places2 = new google.maps.places.Autocomplete(document.getElementById('txtPlaces2'));
google.maps.event.addListener(places,places2, 'place_changed', function () {
var place = places.getPlace();
var address = place.formatted_address;
var latitude = place.geometry.location.k;
var longitude = place.geometry.location.D;
var mesg = "Address: " + address;
mesg += "\nLatitude: " + latitude;
mesg += "\nLongitude: " + longitude;
// alert(mesg);
});
});
</script>
<span>Location 1:</span>
<input type="text" id="txtPlaces" style="width: 250px" /><br /><br />
<span>Location 2:</span>
<input type="text" id="txtPlaces2" style="width: 250px" />