I'm trying to figure out what's going on here.
//JQUERY
for(var i = 0; i < truckOrder.length; i++){
function getDetails(t){
return $.ajax({
url : 'groups/group_'+t+'/content/quickview.html',
type : 'get',
async : false
});
}
getDetails(truckOrder[i]).done(function(result){
var xml = result;
xmlDoc = $.parseXML(xml),
$xml = $(xmlDoc);
//quickfilter
$qf = $xml.find('quickfilter');
//quickprice
$qp = $xml.find('quickprice');
//quicktitle
$qt = $xml.find('quicktitle');
//quicklook
$ql = $xml.find('quicklook engine');
var newTruck = {
quickfilter : $qf.text(),
quickprice : $qp.text(),
quicktitle : $qt.text(),
quicklook : $ql.text()
};
truckDetails.push(newTruck);
}).fail(function(){
console.log("There was an error");
});
}
//XML
<?xml version="1.0" encoding="UTF-8" ?>
<quickfilter>
2015 intM cumE 13T apuNo
</quickfilter>
<quicktitle>
2015 International Lonestar
</quicktitle>
<quickprice>
$15,000 down, $2,595/60 months
</quickprice>
<quicklook>
<engine> Cummins ISX 450HP</engine>
<transmission> 13 speed</transmission>
<features> Aluminum Wheels</features>
</quicklook>
I'm trying to parse multiple xml files, and build an array of objects out of them. When I have been trying to parse the xml files however I get an error like this Uncaught Error: Invalid XML:. I did some research on it, but I never really found anything that helped. This is kind of my first time working this intensely with XMl and jquery together, so any help would be much appreciated!
No comments:
Post a Comment