I have a peice of code that i call inside of $(“document).ready() in jquery that tries to open an xml file and parse it.
$.get('cal.xml', function(data){
alert(data);
var xmlDoc = $.parseXML(data);
var $xml = $(xmlDoc);
});
the alert that pops up is “[object Document]” rather than the actual text of the xml which then throws a problem with $.parseXML(data) saying that
“Uncaught Invalid XML: undefined” (implying that data is undefined).
here is the XML file
<?xml version="1.0"?>
<cal>
<today>
<event>
<time>
6:30pm EST
</time>
<title>
nothing
</title>
</event>
</today>
</cal>
Could someone help me simply read in this XML file and set it up for parsing?
Try to set the dataType option to xml:
“data” should be at this point parsed xml.