我的JSON對象是這樣的:如何顯示json對象到html?
[{
"attributes": {
"Code": "SGL",
"Total": "19421340.27"
},
"DayPrice": [{
"Date": "2016-07-22",
"Rate": "4900439.85"
}, {
"Date": "2016-07-23",
"Rate": "4845150.21"
}, {
"Date": "2016-07-24",
"Rate": "4845150.21"
}, {
"Date": "2016-07-25",
"Rate": "4830600"
}]
}, {
"attributes": {
"Code": "DBL",
"Total": "6473780.09"
},
"DayPrice": [{
"Date": "2016-07-22",
"Rate": "1633479.95"
}, {
"Date": "2016-07-23",
"Rate": "1615050.07"
}, {
"Date": "2016-07-24",
"Rate": "1615050.07"
}, {
"Date": "2016-07-25",
"Rate": "1610200"
}]
}, {
"attributes": {
"Code": "QUAD",
"Total": "6473780.09"
},
"DayPrice": [{
"Date": "2016-07-22",
"Rate": "1633479.95"
}, {
"Date": "2016-07-23",
"Rate": "1615050.07"
}, {
"Date": "2016-07-24",
"Rate": "1615050.07"
}, {
"Date": "2016-07-25",
"Rate": "1610200"
}]
}]
從JSON對象數組,我要顯示這樣的形象:
我有嘗試,但我仍然感到困惑。 我覺得無法做到。
我嘗試循環中循環是這樣的:
countRoomType = json_object.length;
for(var i=0; i<countRoomType; i++){
countDayPrice = json_object[i].DayPrice.length;
for(var j=0; j<countDayPrice; j++){
...
}
}
任何解決方案來解決我的問題呢?
試的jQuery插件模板 –
@DharaParmar,見我的問題。我更新它 –
我嘗試循環循環,但我仍然困惑。這似乎是錯誤的 –