Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在尝试使用嵌入映射API(尽管API已激活)时获取ApiNotActivatedMapError_Javascript_Html_Google Maps_Google Api - Fatal编程技术网

Javascript 在尝试使用嵌入映射API(尽管API已激活)时获取ApiNotActivatedMapError

Javascript 在尝试使用嵌入映射API(尽管API已激活)时获取ApiNotActivatedMapError,javascript,html,google-maps,google-api,Javascript,Html,Google Maps,Google Api,我在网页中嵌入地图,但由于某种原因,我一直得到一个APINotActivatedPaperor,我看着它,它被激活了。我只是在这里不知所措 <div id="map" style="width:100%;height:400px">My map will go here</div> <script> // Initialize and add the map function initMap() { var mapProp= { ce

我在网页中嵌入地图,但由于某种原因,我一直得到一个APINotActivatedPaperor,我看着它,它被激活了。我只是在这里不知所措

<div id="map" style="width:100%;height:400px">My map will go here</div>

<script>
// Initialize and add the map
function initMap() {
    var mapProp= {
        center:new google.maps.LatLng(51.508742,-0.120850),
        zoom:5,
    };
    var map=new google.maps.Map(document.getElementById("map"),mapProp);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY&callback=initMap">
</script>
我的地图将显示在这里
//初始化并添加映射
函数initMap(){
var mapProp={
中心:新google.maps.LatLng(51.508742,-0.120850),
缩放:5,
};
var map=new google.maps.map(document.getElementById(“map”),mapProp);
}

有人有过这个问题的经验吗?我错过了一些简单的东西吗?谢谢

访问console.cloud.google.com并按照以下步骤操作:

1) API与服务

2) 仪表板

3) +启用API和服务

4) 映射JavaScript API


5) 点击启用按钮

您在项目中激活了哪个API?您发布的代码需要激活Google Maps JavaScript API。