Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to parse file with jQuery in IE 8 and below because it's not XML (even though it sort of is XML)

I'm using AJAX to load in a KML file (which is basically an XML file). I'm able to parse everything fine in IE9, FF, etc., but in IE8 it doesn't work. I get the data back but I'm not able to parse it in jQuery. I'm assuming this is because it's not being acknowledged as true XML. If I change the file from us_states.kml to us_states.xml, for example, it works fine. So, I COULD try to have people change their files from kml to xml manually, but I'd prefer being able to read it in and have it work on all browsers, old and new. Here is my ajax call:

$.ajax({
                    url: KMLFile,
                    type: "GET",
                    dataType: "XML",
                    success: function(data){ ...}
});

Thanks in advance for your help.

like image 557
Munzilla Avatar asked Jan 19 '26 00:01

Munzilla


1 Answers

I'd skip the XML/KML issue completely and go straight to JSON:

http://code.google.com/p/geoxml3/wiki/JsonObjects

like image 180
Diodeus - James MacFarlane Avatar answered Jan 21 '26 14:01

Diodeus - James MacFarlane



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!