-1
Today in my system I am displaying as 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. Look forward to.
I need to display the address in the $html variable, all 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>
I get it, I just couldn’t apply it to my script, if you can help me:
– Lucas Spielmann
Give more details. What’s the problem? Have any plunkr or place to see the code?
– Raphael Vizoni
I have updated the initial question in more detail. If you can help me, I would appreciate it very much.
– Lucas Spielmann