K
K
Kirill2017-05-19 00:47:19
css
Kirill, 2017-05-19 00:47:19

Does not connect Google map on the landing page. What could be wrong?

Locally everything works, on a hosting does not work. I use the following function for the map:

<script>
        function google_maps_54af9a6782fc0() { 
            var latlng = new google.maps.LatLng(-33.8710, 151.2039);
            var myOptions = {
                zoom: 13,
                center: latlng,
                zoomControl: true,
                mapTypeControl: false,
                streetViewControl: false,
                scrollwheel: false,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("google-map-area-54af9a6782fc0"), myOptions);
            var marker = new google.maps.Marker({
                position: latlng,
                map: map
            });
        }
        jQuery(document).ready(function($) {
            google_maps_54af9a6782fc0();
        });
    </script>

The hosting says "There was a problem loading Google Maps on this page. You can find the details in the JavaScript console." I already tried to copy the code - paste the API key there. Please tell me what is the problem? is it in the code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill, 2017-05-20
@wtc19

I fixed the error. I commented out the line where " https://maps.google.com/maps/api/js?sensor " is connected
And added the line "" before the script.
I also changed the redirection from http to https on the hosting, respectively, and the links in the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question