日期:2014-05-16 浏览次数:21046 次
function parseXml(p) {
$.ajax({
url:"/injector/parse_xml.php",
type: "POST",
async: false,
cache: false,
dataType: "json",
error: function(){alert('fail');},
success: function(series) {
if(!series || !series.category) {
return;
}
var root = series;
var categories = root.category;
for(var j=0; j<categories.length; j++) {
var category = categories[j];
var categoryName = category["@attributes"].name;
var privileges = category["@attributes"].privileges;
if(privileges == p) {
appendCategory(categoryName);
var items = category.item;
for(var i=0; i<items.length; i++) {
var item = items[i];
var itemName = item.name;
var itemUrl = item.url;
appendItem(itemName, itemUrl);
}
}
}
}
});
}