Hi Andrew,

Thank you very very much for the elaborating answer!

before going on I would just like to verify that i have understood it
correctly...:-)

The GDownloadUrl(url,processMyData) gets the data from the specific
URL. It "send" it to the processMyData-function. That functions
process the data and should display the markers on the map.

Is that correct?

I've progressed one step and FF is not liking that var markerCluster
not is defined. I have markerCluster in the processMyData-function but
the map-argument is defined in the initialize()-function. Is that why
FF is complaining about markerCluster?

Thank you,

/Nimrod

On May 14, 12:51 pm, Andrew Leach <[email protected]>
wrote:
> On May 14, 11:32 am,nimrod<[email protected]> wrote:
>
> > Hi Andrew,
>
> > Thank you for your reply!
>
> > I'm a bit puzzled...GDownloadUrl is asynchronous, yes...
> > Still a newbie and I need to ask...my callback-function in this
> > case...what is that?
>
> The callback function, which is the function to which GDownloadUrl
> passes its data once it's retrieved it, is referenced inside the
> GDownloadUrl() call:
>
>   GDownloadUrl(url, function)
>
> You can write a function called say, processMyData and have it as a
> standalone function in your script:
>
>   function processMyData(passedData) {
>   ...
>   }
>
> [note that it accepts some data]. If you do that, you call it like
> this:
>
>   GDownloadUrl(url,processMyData)
>
> Note there are no brackets after processMyData in that form. You just
> provide the name of the function. GDownloadUrl calls that function
> when it's got the data and passes the data as the argument to the
> function. processMyData receives the data as "passedData".
>
> OR
>
> You can write the function inside the GDownloadUrl call itself:
>
>   GDownloadUrl(url, function(passedData) { ... })
>
> This is called an anonymous function because it doesn't have a name.
> You just define the function with its argument.
>
> You've used this second version, and the function receives the data
> into a variable called "data". You parse "data" and assign the result
> to a variable called "xml". That's all that happens.
>
> After the GDownloadUrl() is started in the background, the code goes
> on to try and do things with "xml". All of that stuff needs to go
> inside the callback function.
>
> You may find it easier to write a separate function which handles the
> data, as the first way outlined above. You can almost certainly just
> extract all the code which deals with the data out of where it is at
> the moment and into a separate function. Call it processMyData(data):
>
>   function processMyData(data) {
>     var xml = GXml.parse(data);
>     var markers = xml.documentElement.getElementsByTagName("marker");
>     // etc
>   }
>
> and then do the GDownloadUrl like
>
>   GDownloadUrl( ...,processMyData)
>
> You'll need to put your url where I've got dots here.
>
> 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