简体   繁体   中英

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. I did make a few changes to the html markup but surely nothing that could be causing this error.

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; 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.

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

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.
  • the script in the head is probably being executed before your page is ready.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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