andresb
September 8, 2023, 6:57pm
1
Hi everybody.
I have a javascript code to insert a Google Geocoder:
$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=' . $this->getServerApiKey();
And need to add the function.prototype as a noop callback to prevent an error.
It should be:
https://maps.googleapis.com/maps/api/geocode....../MY_API_KEY&callback=Function.prototype
I am not a js coder and do not get the way to include the callback at the end of:
$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=' . $this->getServerApiKey();
Thanks.
andresb
September 9, 2023, 10:37am
2
The issue is that the javascript is in a php file:
$address = urlencode($address);
$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=' . $this->getServerApiKey();
$data = json_decode($this->getUrl($url));
I need to add the callback to fix the problem explained in this URL:
How to fix Loading the Google Maps JavaScript API without a callback is not supported
I have tried to insert the callback (&callback=Function.prototype) at the end of the line but in some cases there is no effect at all and in others a page error.