谷歌映射v3 API错误

Des*_*ner 6 google-maps

我在我的一个网站上使用Google Maps v3 API,一切正常.但是从昨天开始我每次尝试访问地图页面时都会突然发现此错误:

Error: Script terminated by timeout at: 
f@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:1:175 
next@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:2:310 
hx@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:7:457
_.jl.prototype.Yb<@http://maps.googleapis.com/maps-api-v3/api/js/3/1a/map.js:54:163 
Uy@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:38:313
Xy/<@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:39:307 
Run Code Online (Sandbox Code Playgroud)

知道为什么会这样吗?

Adi*_*lla 3

这是纬度和经度的问题。

纬度和经度应该是“浮点”数字。如果我们向它传递其他数据类型,它会冻结浏览器,因为它正在等待带有错误数据类型的谷歌响应。

function drawMap( lat, lng ) { lat = parseFloat(lat); lng = parseFloat(lng); if ( ! isNaN( lat ) && ! isNaN( lng ) ) // Before sending it to google let check if they are valid values
{
    var mapOptions = {
        center: new google.maps.LatLng(44.5452, -78.5389),
        zoom: 5
    };
    map = new google.maps.Map(document.getElementById('vehicle_country_region_from_map'),   mapOptions);
}}
Run Code Online (Sandbox Code Playgroud)