geocoder - c is undefined

geocoder - c is undefined

本文关键字:undefined is geocoder      更新时间:2023-09-26

所以我在我的网站上使用了谷歌本身的例子:

var geocoder = new google.maps.Geocoder();
            if (geocoder)
            {
                geocoder.geocode({ 'address': 'australia' }, function (results, status)
                {
                    if (status == google.maps.GeocoderStatus.OK)
                    {
                        console.log(results[0].geometry.location);
                    } 
                    else
                    {
                        console.log('No results found: ' + status);
                    }
                });
             }

但我得到一个错误"c未定义"有人能帮忙吗?

来自谷歌的脚本已成功添加到我的标题中。我已经在使用第二个脚本来显示地图,这确实有效。

如果您通过Firefox浏览器在Windows 2012服务器上运行地理编码javascript,我会收到相同的错误消息"c is undefined"。然而,它在IE和Chrome中运行良好。此外,如果我使用Firefox在Windows2003服务器上运行相同的脚本,它可以正常工作,不会给我错误。你试过这些浏览器吗?运行代码的服务器是什么?

您正在使用Firebug吗?如果是这样,请关闭它,您的脚本应该不会出错。