On Feb 2, 6:38 pm, Drew <[email protected]> wrote: > Mike - > > That's a great explanation for the problem. Thanks for explaining how > this works. > > I may need to toil with the solution you suggested though. Could you > mind to elaborate just slightly on "once it has successfully obtained > the data" ? Are you suggesting I monitor for the completion of the XML > response? How would I do this?
That is what the callback function if for. It is executed when the data comes back. It is the request.onreadystatechange function. -- Larry > > Thanks again, > Andrew > > On Feb 2, 12:56 am, Mike Williams <[email protected]> wrote: > > > > > The problem is that your addMarkersFromXML() function is asynchronous. > > It returns VOID immediately to your addMarkersFromXML(50) call, and you > > pass that VOID to mgr.addMarkers() which it then tries to use as its > > "markers" array. Some time later, the data from your XML file arrives > > and your callback function tries to return that data to the API callback > > caller, but by then it's far too late. > > > If you'renotfamiliar with the concept, see: > > http://econym.org.uk/gmap/async.htm > > > I recommend passing the zoom level to addMarkersFromXML(), and allowing > > it to call mgr.addMarkers(batch,zoom) once it has successfully obtained > > the data. > > > --http://econym.org.uk/gmap > > The Blackpool Community Church Javascript Team- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
