简体   繁体   English

Google Maps API V3未定义的地理编码器错误

[英]Google Maps API V3 undefined geocoder error

So I have what is essentially a customised "venue locator", designed for a mobile site. 因此,我实际上是为移动站点设计的定制“场地定位器”。 It's very much a work in progress, but has been functioning absolutely perfectly (for well over a month) until today. 这项工作仍在进行中,但是直到今天为止,它的功能一直非常完美(一个多月以来)。 Now when I click on my search button I'm getting an undefined error where I've declare the geocoder: 现在,当我点击搜索按钮时,在声明地址解析器的地方出现了一个未定义的错误:

var geocoder = new google.maps.Geocoder();

I've made a few changes to the external css and js today, but no changes to the js in the document itself. 今天,我对外部CSS和JS进行了一些更改,但文档本身中的JS没有更改。 I did make a few changes to the html markup but surely nothing that could be causing this error. 我确实对html标记做了一些更改,但是肯定没有什么可能导致此错误。

I've tried writing an initialise function to be called once the page is loaded, and including my map creation and geocoder declaration within that - as I've read that this problem often occurs when the maps API hasn't loaded fully - but it hasn't worked thus far; 我尝试编写一个初始化函数,以便在页面加载后调用该函数,并在其中包括我的地图创建和地理编码器声明-因为我读过,当地图API尚未完全加载时,经常会发生此问题-但它到目前为止还没有工作; in fact, I've tried everything I've been able to find in other threads here and in other forums, also to no avail. 实际上,我已经尝试了在其他论坛和论坛中找到的所有内容,但均无济于事。 Occasionally while I was troubleshooting I'd get errors thrown up from the Google Maps main.js file too. 有时,在我进行故障排除时,我也会从Google Maps main.js文件中引发错误。

I don't understand how I could have had zero errors for the past month and now, suddenly, this. 我不明白在过去的一个月中我怎么可能有零错误,而现在突然之间。 If anyone can be bothered taking a look, the page is at http://www.quizmeisters.com.au/mobile-test/find.html 如果有人可以打扰一下, 请访问http://www.quizmeisters.com.au/mobile-test/find.html。

Thanks. 谢谢。

a few things to note: 注意事项:

  • rollback your code to the previous version and check if it works. 将您的代码回滚到以前的版本,并检查其是否有效。 then start making changes one at a time (change -> check; change -> check). 然后开始一次更改一次(更改->检查;更改->检查)。
  • there is no map in your link. 您的链接中没有地图。 you search for a div with id = map , but i couldn't find this element in your code. 您搜索id = mapdiv ,但我在您的代码中找不到此元素。
  • the script in the head is probably being executed before your page is ready. 在页面准备就绪之前,可能已经执行了头部的脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM