<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
$(document).ready(function () {
debugger;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
}
else {
alert("Geolocation is not supported by this browser.");
}
function showPosition(position) {
debugger;
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
var geocoder = geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
document.getElementById("txtaddress").value = results[1].formatted_address;
}
}
});
}
});
</script>