I have a directions service in my php page for which I take destination latlng value from another php page
var dest='<?php echo $dest;?>';
The directions do display. I want to show the address of destination from the latlng for which I had used reverse-geocoding:
var geo = new google.maps.Geocoder();
geo.geocode({'latLng':dest},function(results,status){
document.getElementById('txtDestination').innerHTML = results[1].formatted_address;
});
But it is not taking the value of latlng throwing the error:
InvalidValueError: in property latLng: not a LatLng or LatLngLiteral: not an Object
I had test value of dest using alert()
it shows correct but I don't why it doesnt take in Geocoder()