Reverse geocoding with Google API


I try to find an address based on their geolocation (reverse geocoding) using Google Map API.

Somehow my script got stuck somewhere, but I’m not sure where I can solve the problem. Can you help me to find it out what is wrong the script?

Where is my address? without button

It supposed to be working like this one Where is my address? with button


The variable latlng isn’t available to the function geocodeLatLng unless you pass it in. Once I did that, the geocoding worked fine.

Defined on line 23

function geocodeLatLng(geocoder, map, infowindow, latlng)

Called on line 19

geocodeLatLng(geocoder, map, infowindow, latlng);

thank you very much @PortableStick