I can't understand what is the problem? I used this example from Google Map APIs: Simple Map
<body>
<!-- Map Section -->
<section id="map"></section>
<script src="js/jquery.min.js"></script>
<script src="js/main.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB5Y8CqFe-4Egzl5TlPqlFvjRGcuCfHGvY&callback=initMap" async defer></script>
</body>
main.js:
//--------------------------------------------------
// Contact Map
//--------------------------------------------------
function initMap() {
if ($("#map").length > 0)
{
var map;
map = new google.maps.Map(document.getElementById('map'),{
center: {lat: 44.4297538, lng: 26.0649221},
zoom: 16,
scrollwheel: false,
zoomControl: false,
panControl: false,
streetViewControl: false,
mapTypeControl: false,
overviewMapControl: false,
clickable: false
});
}
}
Error:
message: "initMap is not a function"
name: "InvalidValueError"