The technique Mike is describing is asynchronous. I have build a test page, that uses this approach at http://www.einberg-volleyball.de/maps/test/json2.html
You might want to read the full thread: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/d425fc171112cdcc/b8f28118b67410a2#b8f28118b67410a2 Jürgen On 25 Okt., 11:07, "Neil.Young" <[EMAIL PROTECTED]> wrote: > Hi Mike, > > I see. I see. Yes, this makes sense... Thanks for the fine explanation > and the samples. I'll think it over, probably I'll have to redesign my > app to use this approach. I don't have a complete picture yet, but I > think it might be possible. > > Currently I'm using a relatively straight forward approach: The HTML > body has some form elements, used to parametrize the "GDownloadUrl" > query to my server. When the page loads, the very first action onload() > is to "GDownloadUrl" from the server. In the asynchronous callback I'm > then rendering the map with all the controls and markers returned from > my server using the params provided. The returned data is already JSON > formatted. > > Kind regards > > Mike Williams schrieb: > > > > > Wasn't it Neil.Young who wrote: > > >> And there is another fact, driving me crazy a bit: Even if ActiveX > >> support is disabled and GDownloadUrl fails, GDirections works without > >> any problems. On what track is GDirections running? > > > GDirections can't use anything remotely like GDownloadUrl or > > XMLHttpRequest or ActiveX, because it has to work cross domain. Those > > techniques are limited to accessing data from the same domain, for > > security reasons. > > > GDirections, and all the other cross-domain API services, ends up using > > a <script src="..."> tag to fetch Javascript code. That will work across > > domains, and I believe that it will work in any environment where > > Javascript is enabled. > > > If you want to try that, you need to rewrite your data as Javascript > > code, which could be as simple as gluing your existing data onto a > > single line and then putting it into a string, like > > var data = '<markers> <marker lat="43.1" lng="-79.2"> ... </markers>' > > Note: watch out for the fact that there's now an *extra* level of > > quotes. > > > Process it like this: > > document.write('<' + 'script src="' + url + '"' + > > ' type="text/javascript"><' + '/script>'); > > > I guess it's synchronous, in which case you can immediately write > > if (data) { > > var xmlData = GXml.parse(data); > > ... > > } > > > If you find that it's asynchronous, I guess you could put the Javascript > > code that processes the data into the file itself > > > var data=' ... '; > > var xmlData = GXml.parse(data); > > var markers = xmlDoc.documentElement.getElementsByTagName("marker"); > > for (var i = 0; i < markers.length; i++) { > > ... > > var marker = createMarker(point,label,html); > > map.addOverlay(marker); > > }- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
