此页面无法正确加载谷歌地图



我试图从地图中获取纬度和经度,但出现此错误:

此页面无法正确加载谷歌地图。

我不确定是什么原因导致此错误。 我是否需要添加密钥,或者它只是代码中的错误?

任何帮助,不胜感激。

我的代码

<script type="text/javascript">
$("#selectLocation").hide();
$(document).on("click",".setSelectLocation",function() {
$(".setSelectLocation").hide();
$("#selectLocation").show();
});
$("#area_id option").hide();
$("#area_id option[data-parent=" + $('#country').val() + "]").show();
$(document).on("change","#country",function() {
var value = $(this).val();
$("#area_id").show();
$("#area_id option").hide();
$('#area_id').prepend('<option disabled selected value="#">أختر المحافظه</option>');
$("#area_id option[data-parent=" + value + "]").show();
});
function initialize() {
var e = new google.maps.LatLng(24.701925,46.675415), t = {
zoom: 5,
center: e,
panControl: !0,
scrollwheel: 1,
scaleControl: !0,
overviewMapControl: !0,
overviewMapControlOptions: {opened: !0},
mapTypeId: google.maps.MapTypeId.terrain
};
map = new google.maps.Map(document.getElementById("latlongmap"), t)
geocoder = new google.maps.Geocoder
marker = new google.maps.Marker({
position: e,
map: map
})
map.streetViewControl = false
infowindow = new google.maps.InfoWindow({
content: "(24.701925,46.675415))"
})
google.maps.event.addListener(map, "click", function (e) {
marker.setPosition(e.latLng);
var t = e.latLng
o = "(" + t.lat().toFixed(6) + ", " + t.lng().toFixed(6) + ")";
infowindow.setContent(o),
document.getElementById("lat").value = t.lat().toFixed(6),
document.getElementById("lng").value = t.lng().toFixed(6)
})
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=KEY&language=ar&callback=initialize"></script>

对于在加载带有"仅用于开发目的">消息的 Google 地图时遇到"此页面无法正确加载 Google 地图">错误的任何人:

有问题的错误是这样的:https://developers.google.com/maps/faq#api-key-billing-errors

要使用谷歌地图平台产品,必须进行结算 在您的帐户上启用,并且所有请求都必须包含有效的 API 键

希望这有帮助。

最新更新