views:

536

answers:

1

Hiya All,

I have a Google Map on our site that has a list of markers which are brought in using the following code:

$(".map-overlay-right").click(function () {
 var map = new GMap2(document.getElementById('map-holder'));
 $("#map-holder").fadeOut('slow', function(){         
  var gmarkers = []; 
  map.addControl(new GSmallMapControl());
  map.addControl(new GMapTypeControl());

  $.get("http://afid.staging.dante-studios.com/xml-feed-google-maps",{},function(xml) {
   $('marker',xml).each(function(i) {
    html = $(this).text();
    lat = $(this).attr("lat");
    lng = $(this).attr("lng");
    label = $(this).attr("label");
    var point = new GLatLng(lat,lng);
    var marker = createMarker(point,label,html);
    map.addOverlay(marker);
   });
  });

 });
 $("#map-holder").fadeIn('slow'); 
 var Asia = new GLatLng(23.684774, 90.087891);
 map.setCenter(Asia, 4); 
});

The XML file that brings them in looks like this:

<?xml version="1.0"?>
<markers> 
    <marker id="1" lat="11.547812" lng="104.915957" label="Foo"> 
     <infowindow> 
      <![CDATA[HTML GOES HERE]]>
     </infowindow> 
    </marker> 
    <marker id="2" lat="11.547812" lng="104.915957" label="Bar"> 
     <infowindow> 
      <![CDATA[HTML GOES HERE]]>
     </infowindow> 
    </marker> 
    <marker id="3" lat="11.547812" lng="104.915957" label="Baz"> 
     <infowindow> 
      <![CDATA[HTML GOES HERE]]>
     </infowindow> 
    </marker>  
</markers>

For some reason not all the markers show up in Internet Explorer. IE throws this error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)
Timestamp: Thu, 17 Dec 2009 12:39:16 UTC


Message: Invalid argument.
Line: 143
Char: 18
Code: 0
URI: http://maps.gstatic.com/intl/en_ALL/mapfiles/193c/maps2.api/main.js

But the rest of the browsers seem to be ok and behaving well. The part of the code that throws the error is this bit:

map.addOverlay(marker);

The site can be seen here: http://afid.staging.dante-studios.com/ and clicking on Asia will best show the error as the markers at the bottom of india show up on all browsers but not in IE.

I've spent a while trying to resolve this but i'm not getting anywhere. If anyone can shed some light on this i would highly appreciate it.

+1  A: 

Market 42 in your marker XML has a malformed latitude:

<marker id="42" lat="-12.968270," lng="28.633699" label="Ndola, Zambia">

Note the trailing comma in the lat attribute.

jon hanson
Amazing eyes! thank you :)
Shadi Almosri
Actually when i opened it in IE and it barfed, it allowed me to debug it with Visual Studio. I figured it was a bogus marker so after a bit of stack navigation i found the offending latitude value, then just searched for it in the XML.
jon hanson