'"myMap is not a function" error when using the Google Maps API
I know this has been asked before. But the situation is that I'm referring the function before loading the map api.
This was working a few days ago, and started giving me this error out of nowhere. I'd be grateful if someone could help me.
Error:
//HTML
<script src="assets/js/scripts.js"></script>
<script>
var markers = [];
function myMap() {
var mapProp = {
center: new google.maps.LatLng(39.7312983, -7.5951745),
zoom: 5
};
var image = 'https://imgur.com/9SsOEZu.png';
var map = new google.maps.Map(document.getElementById('google-map'), mapProp);
//Some PHP
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=API_key&callback=myMap">
</script>
</body>
</html>
Solution 1:[1]
Well, I solved it. The problem had nothing to do with Google Maps API but with a badly inputed value in the database that caused the code to crash before loading any JS.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Henrique GuimarĂ£es |

