我有以下JSON代碼:JSON的foreach不工作
{
"chat": [
{
"username": "demo",
"text": "hi man",
"time": "1380167419"
},
{
"username": "admin",
"text": "hi",
"time": "1380167435"
},
{
"username": "demo",
"text": "this works flawless now.",
"time": "1380167436"
},
{
"username": "demo",
"text": "we basically done/",
"time": "1380167443"
}
]
}
當我運行:
var codes = JSON.parse(history); //history is the above JSON.
$.each(codes, function(key, value){
alert(value.chat.username);
});
它沒有任何警告,並不斷告訴我value.chat.username是不確定的...
我在哪裏做錯了?
你不明白爲什麼那些倒票...但感謝你的幫助球員。 – jackhao