Skip to content
Advertisement

Javascript – Google map not displaying

I am trying to create a page that shows google map and allows users to draw lines on the map and save them.. but when I try to run the page, the map doesn’t show up at all. What am I doing wrong? the page is literally blank with the form at the end.

I was having a look online for a solution.. I found this code and modified it with my api key

JavaScript

Advertisement

Answer

  1. your HTML is invalid (no end tag for head, no start tag for body).
  2. when you are loading the API synchronously, you need to include it before you use it.
  3. when you are loading the API synchronously, you need to move the javascript after the DOM

working fiddle

enter image description here

code snippet:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement