On May 14, 10:07 am, nimrod <[email protected]> wrote:
>
> Hmmm...next challenge is that FF complaints on:
> var markers = xml.documentElement.getElementsByTagName("marker");
> and says that "XML is not defined". I reverified that the XML is
> printed as it should and it is ok.
>
> Do you (or anybody else) have a suggestion?

GDownloadUrl is asynchronous. That means it gets on with the job
behind the scenes and then calls the "callback function" to deal with
the results when it's finished. Your callback function defines the
variable "xml".

Once GDownloadUrl has started to do its stuff, the main execution
carries on in the foreground. The next line tries to use "xml", which
is only defined in the callback function, and that hasn't run yet.

You need to do everything with "xml" **inside** the callback function.

Mike has an explanation of asynchronous code in his tutorial
http://econym.org.uk/gmap

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to