您的位置:首页 > Web前端 > JQuery

jQuery的filter过滤重复结构的xml数据

2013-08-24 02:48 302 查看
<?xml version="1.0" encoding="utf-8" ?>
<bookstore>
<book>
<title>Rain</title>
<year>2010</year>
<author>Martin</author>
</book>
<book>
<title>Cloud</title>
<year>2009</year>
<author>Robert</author>
</book>
<book>
<title>River</title>
<year>2007</year>
<author>Fred</author>
</book>
</bookstore>

$(document).ready(function () {
$.get("xmlData/Categories.xml", function (xml) {
$(xml).find("book").filter( function (index) {
return "Rain" == $(this).find("title").text();
}
).each( function (index) {
alert($(this).find("author").text());
});
});
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: