i have a xml file like
<?xml version="1.0" encoding="ISO-8859-1"?>
<childrens>
<child entity_id="1" value="Root Catalog" parent_id="0">
<child entity_id="2" value="Apparel" parent_id="1">
<child entity_id="4" value="Shirts" parent_id="2"/>
<child entity_id="5" value="Pants" parent_id="2"/>
</child>
<child entity_id="3" value="Accessories" parent_id="1">
<child entity_id="6" value="Handbags" parent_id="3"/>
<child entity_id="7" value="Jewelry" parent_id="3"/>
</child>
</child>
</childrens>
n have tried to get data where parent_id=2 n have written this jquery code
$(document).ready(function(){
$.ajax({
type: "GET",
url: "test.xml",
dataType: "xml",
success: function(xml) {
$(xml).find('child').attr('[parent_id=3]').each(function(){
var id = $(this).attr('entity_id');
alert(id);
});
}
});
});
but it is not working
if i remove .attr('[parent_id=3]') then each id will be alert