Google Maps JavaScript API not showing on Server

Andrés Robles Posted in Component Development 6 years ago

Hey there..

i use the gmaps JS api on BusinessPage Component, on the add.php form like this:

Localhost-bpagemap

In my localhost is working fine, but on the server it looks like this:

enter image description here

I have the key and everything OK, idk why is always throwing me this error:

Uncaught TypeError: organizations.forEach is not a function
at OrganizationsDefault (mapas.js:56)
at mapas.js:57

And this one on other application of the same API (where i show all the bpage address on the map):

mapas.js:66 Uncaught ReferenceError: google is not defined
at showModal (mapas.js:66)
at HTMLAnchorElement.onclick (add:1)

I googled the errors but can't fix yet, any idea?

Replies
cl Andrés Robles Replied 6 years ago

Yes, thak you very much.. it solved changing what you guys said..

document.body.appendChild(script3);

for

document.head.appendChild(script3);

Indonesian Arsalan Shah Replied 6 years ago

Any status on this? have solved the issue?

Indonesian Arsalan Shah Replied 6 years ago

Further when i visit http://app.arcoluna.cl/page/add (after login) i see : Uncaught ReferenceError: locations is not defined error which mean the google api script isn't loaded.

You should try to include google api in head of your website rather loading via js

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&libraries=places&sensor=false&key=myapikeysgoeshere&callback=initialize";></script>
German Michael Zülsdorff Replied 6 years ago

Since your site is running with cache enabled it's hard to track down your javascript....
All I can see in my browser's developer console is: The google script which is responsible to connect to the server api does not appear. And your way of trying to load that script within the body section at the bottom appears confusing to me by the way. So, I would simply try to load it in the header section, as recommended by google.

bb Daniel DeSouza Replied 6 years ago

Hi Andres,

Thank you for committing to shearing your components with the OSSN community, I for one will be very interested to see what you have come up with.

Blessings...

cl Andrés Robles Replied 6 years ago

Hey Arsalan, thanks for your kindness and goodwill..
This is the URL:http://app.arcoluna.cl/

ps. Now im testing a bunch of components that i developed with my team, and after that i would like to talk to you, because im doing a lot of programming and i would like to share and contribute with the OSSN community :)

Indonesian Arsalan Shah Replied 6 years ago

Hello, It seems there is a connection issue it said 'google is not defined' https://stackoverflow.com/questions/12249136/referenceerror-google-is-not-defined

If you share your website URL i'll take a look and confirm if the issue is with the API loading or something else.