Answer the question
In order to leave comments, you need to log in
Why does google map throw an error at times?
Hello. Connected to the site google maps.
I connect at the end of the page, the very first script.
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDwOV3ft4xXnuj9f7aCPTcdKF_bTn6g25A&callback=initMap" async=""></script>
$(function() {
$(document).ready(function(){
window.initMap = function() {
var myLatLng = {lat: 45.1201, lng: 39.0096};
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
scrollwheel: false,
zoom: 18
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hello World!'
});
}
});
});
Answer the question
In order to leave comments, you need to log in
Do instead
window.initMap = function() {simply
function initMap() {, and most importantly, take it outside
$(function() {and before connecting the file from Google.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question