看板 Ajax 關於我們 聯絡資訊
我想迴圈跑出a.json的全部資料 不過他都只能跑出第二筆資料= =" ================================== a.json: { 'yahoo': { "id": '123', } }, { 'google': { "id": '456', } } =================================== index.php: $.getJSON('a.json', function (data){ $('div #box').empty(); $.each(data, function (entryIndex, entry){ var html = entry['id']; $('div #box').append(html); }); =================================== 我寫這樣他只能讀到第二個id=456 = =" 而且是只能直接讀id 我寫成"yahoo": "123" 然後entry['yahoo'] 這樣的話會變成undefined 不知道是哪裡出問題!? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.204.112 ※ 編輯: askq 來自: 140.115.204.112 (01/21 02:13)