Today in my system I am displaying as a reference point data already registered in the system based on latitude and longitude. I would like the script to find the reference provided by the maps API itself, only me providing the current latitude and longitude. I await.
I need to display the address in the $ html variable, the rest of the code is ok:
<?php
$html .= "<td>".exibir aqui endereço."</td>";
?>
<script language = "javascript">
function GetAddress() {
var lat = parseFloat('$lat');
var lng = parseFloat('$lon');
var latlng = new google.maps.LatLng(lat, lng);
var geocoder = geocoder = new google.maps.Geocoder();
geocoder.geocode({
'latLng': latlng
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
alert("Location: " + results[1].formatted_address);
}
}
});
}
</script>