Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This gentleman has an example of using GDownloadUrl at: <a href="http://googlemapsapi.blogspot.com/2007/02/gdownloadurl-update-better-error.html" rel="nofollow">http://googlemapsapi.blogspot.com/2007/02/gdownloadurl-update-better-error.html</a></p> <p>You might try adding the responseCode parameter to your callback function to see if Chrome is erroring for some reason. This example works in my version of Chrome, so make sure you are running the latest version. </p> <p>Here is his code example:</p> <pre><code>function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(37.4419, -122.1419), 13); // Download the data in data.xml and load it on the map. The format we // expect is: // &lt;markers&gt; // &lt;marker lat="37.441" lng="-122.141"/&gt; // &lt;marker lat="37.322" lng="-121.213"/&gt; // &lt;/markers&gt; GDownloadUrl("data.xml", function(data, responseCode) { // To ensure against HTTP errors that result in null or bad data, // always check status code is equal to 200 before processing the data if(responseCode == 200) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i &lt; markers.length; i++) { var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); map.addOverlay(new GMarker(point)); } } else if(responseCode == -1) { alert("Data request timed out. Please try later."); } else { alert("Request resulted in error. Check XML file is retrievable."); } }); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload