Can't get Markers to load form XML file in google maps

Oriefrituen

New Member
I'm trying to create markers on a google map from data stored in an XML file.\[code\]<rows> <row> <Content Type>Case Study</Content Type> <Solution Area/ Theme>Efficiency Optimization</Solution Area/ Theme> <Ecosystem>Energy & Utilities</Ecosystem> <Location>Abu Dhabi</Location> <City>Abu Dhabi</City> <lat>24.443935</lat> <long>54.41905</long> <Region>EMEA</Region> <Title>TAQA's multinational activity benefits from a single global banking partner</Title> </row></rows>\[/code\]my XML file is in the same directory as the HTML. there are about 100 markers to plot. I'm trying to use this simple jQuery example to do it (after allot of other things). HELPhere is my code\[code\]<html><head><meta name="viewport" content="initial-scale=1.0, user-scalable=no" /><meta http-equiv="content-type" content="text/html; charset=UTF-8"/><title>Google Maps JavaScript API v3 Example: Common Loader</title><script type="text/javascript" src="http://www.google.com/jsapi"></script><script type="text/javascript" src="http://stackoverflow.com/questions/14589441/util.js"></script><script type="text/javascript"> google.load("maps", "3", {other_params:"sensor=false"}); google.load("jquery", "1.3.2"); function initialize() { var myLatlng = new google.maps.LatLng(10, 0); var myOptions = { zoom: 2, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); jQuery.get("data.xml", {}, function(data) { jQuery(data).find("row").each(function() { var marker = jQuery(this); var latlng = new google.maps.LatLng(parseFloat(marker.attr("lat")), parseFloat(marker.attr("long"))); var marker = new google.maps.Marker({position: latlng, map: map}); }); }); } google.setOnLoadCallback(initialize);</script></head><body> <div id="map_canvas" style="width:400px; height:300px"></div></body></html>\[/code\]
 
Back
Top