armandor10 / gmaps-samples

Automatically exported from code.google.com/p/gmaps-samples
0 stars 0 forks source link

Loading XML from another website? #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello All,
I need to load an XML file from a website.

I'm using
GDownloadUrl("sonHafta.xml", function(data) code and it works correctly.
but whem i'm trying to use

GDownloadUrl("http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/sonHafta.xml"

nothing happens.
I'm very new at Google Maps developing

All Of Codes,

    <script type="text/javascript">

    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));

        map.addMapType(G_PHYSICAL_MAP);
        map.addMapType(G_SATELLITE_3D_MAP);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(39.614495, 30.341861), 5);
        map.enableGoogleBar();

        GDownloadUrl("http://www.koeri.boun.edu.tr/sismo/zeqmap/xmlt/sonHafta.xml", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("earhquake");
          for (var i = 0; i < markers.length; i++) {
            var latlng = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            map.addOverlay(new GMarker(latlng));
          }
        });
      }
    }

  </script>
Am I need some extra codes to load XML from another website?
I'm working at localhost right now.

Best Regards

Original issue reported on code.google.com by cengizha...@gmail.com on 23 Nov 2011 at 10:36