JosonData的数据遍历问题
我想在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){
}
});
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
谢谢,已经解决
items.t数组再遍历