Google Maps Api error

0

Error:

  

Uncaught TypeError: Can not read property 'firstChild' of null at   Object ._. Og (js? Key = AIzaSyANNd20FnR5uWOum1z4Oftu1Ip2Fj4yV-A: 88) at new   Sg (js? Key = AIzaSyANNd20FnR5uWOum1z4Oftu1Ip2Fj4yV-A: 89) at success   (exercise1.js: 15)

This is my code, the error is given in the line of the map variable. The script of js and the one of the api of google maps with the key are put perfectly, I do not know of where the failure can come:

function cargaPagina(){
    navigator.geolocation.getCurrentPosition(exito, error);

    document.getElementById("ubicacion-actual").innerHTML="Ubicación actual";
}

function exito(location){

    var uluru = {lat: location.coords.latitude, lng: location.coords.longitude};
    var map = new google.maps.Map(document.getElementById("mapa"), {
      zoom: 4,
      center: uluru
    });
    var marker = new google.maps.Marker({
      position: uluru,
      map: map
    });

}
    
asked by 08.03.2018 в 18:07
source

0 answers