Trying to show text from an XML file
Hello,
I am trying to populate an array with terms from an XML file but I can't seem to get it going. The alerts below do not show any information or text from the XML file. Is this not storing the entire XML element? Later I will need to index with the 'term' attribute and return one of the other attributes.
- $(document).ready(function()
{
var glossArray = [];
$.get('glossary/glossary_data.xml', function(d){
$(d).find('item').each(function(){
glossArray.push($(this).val());
alert($(this).val());
//alert("In the get xml function");
});
alert("In the get xml function " + glossArray[2]);
});
});
- <glossary>
<!-- A -->
<item term="AAA" def="Not the American Automobile Association" rollover="A is A for A" />
<item term="ABCCC" def="A, B,C,C and C" />
- <item term="DD" def="Drunk Driving" />
</glossary>