Hope someone can fix this (hopefully simple) issue I’m having.
We’ve got a Google Map pulling in Geo-Coded data from a web service, which returns an array of results.
Also, it geocodes the UK post code of the user and plots a yellow ‘home’ marker on their location on the map.
This works fine in IE, but the marker does not display in Safari or Firefox.
In the Firefox error console we get back ‘map is undefined’. I’ve narrowed it down to the line, but can’t find a way of fixing this issue as of yet.
~Note my code is not streamlined yet, so there maybe some unnecessary js code in there in places. But I’d like to be able to to Beta test this with our users shortly.~
Link to the service….
http://www.stratford.gov.uk/labs/nhs/
Enter CV37 6HX as a test postcode, and choose from any of the radio button options before searching.
Cheers!
Simon
When I analyze the error in IE7, I see that the map variable is undefined when you get the callback which triggers localSearch2.setSearchCompleteCallback.
You should check that the function loadMap() which initializes the map completed successfully before starting the search. I see that you initialize it with
This will only load the map on “load” event. It appears that your callback is triggered too soon, before the map is initialized: you trigger the search when you call
This is done during the execution, before the loadMap function gets triggered by the “load” event.