Ok so I have been sitting here staring at my screen for hours and something just isn't working so I had to ask.
I have an XML file that follows this format:
<news attribs="thedate,image,thetext">
<item thedate="<redacted>" image="<redacted>"><![CDATA[<redacted>]]></item>
...
</news>
and here is my JS
$.ajax({
type: "GET",
url: "news.xml",
dataType: "xml",
success: function (xml) {
console.log(xml);
$(xml).find('item').each(function () {
var date, image, text;
date = this.thedate;
image = this.image;
text = this.text();
console.log(date, image, text);
});
},
error: function () {
alert("An error occurred while processing the XML file.");
}
Right now I am literally just trying to get the XML file to load in. I have been working on this for a few hours at work and I have hit a wall and I feel like I'm just missing an obvious error somewhere.The console.log(xml); doesn't post anything to the console which makes me think the file just isn't loading in but it stopped giving me an error so I have NO IDEA.
Side question: I am also not sure about the format for getting the attributes but I need to fix the xml loading before I can even touch that.
console.log('Result:', xml)would make it pretty clear whether or not it's getting to success or the xml is empty.