Question: I need to integrate a google map in my web page. I generated a API. But the map is not displaying. I am testing it in my local server. 

```
<h3>My Google Maps Demo</h3>
<div id="map">
    <span class="labels">Heading</span>
</div>
<script  src="https://maps.googleapis.com/maps/api/js?key=[API]&callback=initMap">
</script>
<script type="text/javascript">
    function initMap() {
                alert("Yes");
                var uluru = { lat: -25.363, lng: 131.044 };
                var map = new google.maps.Map(document.getElementById('map'), {
                    zoom: 4,
                    center: uluru
                });
                var marker = new google.maps.Marker({
                    position: uluru,
                    map: map
                });
            }
</script>

```

but no use. Is their any issue in my code? Can i check my API is working or not

Answer: 
You need to have api key to access the maps. Modify your code like this:

JS:

```
 function initMap() {
   alert("Yes");
   var uluru = {
     lat: -25.363,
     lng: 131.044
   };
   var map = new google.maps.Map(document.getElementById('map'), {
     zoom: 4,
     center: uluru
   });
   var marker = new google.maps.Marker({
     position: uluru,
     map: map
   });

 }
 google.maps.event.addDomListener(window, "load", initMap);

```

Check this demo: <http://jsfiddle.net/lotusgodkk/hLenqzmy/64/>

You can get the api key from here: <https://developers.google.com/maps/documentation/javascript/get-api-key>
Also, initMap will be called while the page is loading, and MIGHT not have been declared at the time it was called?