2
回答
JosonData的数据遍历问题
科大讯飞通用文字识别100000次/天免费使用。立即申请   
我想在js中对这样返回的数据进行遍历{"firstPageNum":0,"firstResult":0,"items":[{"deleteFlag":false,"detailPic":"upload/14564559273171.18.jpg","financingKind":1,"financingName":"test","financingNum":"122121","isDisplay":0,"netWorths":[{"date":"2016-03-03 16:33:45","deleteFlag":false,"netWorth":1.004,"recNum":11,"updateTime":"2016-03-02 14:39:54"}],"titlePic":"upload/14564559273171.18.jpg","updateTime":"2016-03-02 14:39:54"}],"lastPageNum":0,"nextPageNum":0,"pageNum":1,"pageRows":1,"pageSize":15,"prePageNum":0,"totalPages":1,"totalRows":1}   主要是netWorths怎么遍历出来,想在网页显示的时候把netWorths里面的netWorth显示出来   js方法:function showFinancingProductList(type){
if(type != null){
$.ajax({
url: 'financingProduct-listFinancingProductByAjax.wx',
type: 'post',
dataType: 'json',
data: {"condition.financingProduct.financingKind":type},
success: function(jsonData){
if(jsonData.error == 1){

}else{
$('div.mainbox').empty();
var listHtml = [];
$.each(jsonData.items, function(i ,item){
if(i == 0){
listHtml.push('<a href="financingProduct-toFinancingProductDetail.wx?id=' + item.financingNum + '"><img src="' + item.titlePic + '" style="padding: 0 15px;width: 503px; height: 302px;"  alt=""/><h2 class="title">' + item.financingName + '</h2><h3 class="netWorth">'+item.netWorths+'</h3></a><ul class="products">');
}else{
listHtml.push('<a href="financingProduct-toFinancingProductDetail.wx?id=' + item.financingNum + '"><li class="clearfix"><h2 class="txt fl">' + item.financingName + '</h2><h3 class="txt f1">'+item.netWorths+'</h3><img src="' + item.titlePic + '" width="97" height="96"  alt="" class="fr"/> </li></a>')
}
});
$('div.mainbox').append(listHtml.join(''));
}
},
error: function(e){
}
});
}

}
JS
举报
周龑星
发帖于2年前 2回/268阅
顶部