我試圖使用JSON傳遞表,如下所示。在json中傳遞表
sample.json
{
"title": "sample data",
"body": "<table border=\"1\" width=\"600\" bordercolor=\"#FFFFFF\"><tr><td>Column 1</td> <td>Column 2</td></tr></table>"
}
我使用Javascript代碼讀取JSON文件,
$.getJSON("sample.json", function(data) {
console.log(data);
});
但生成以下錯誤
[JAVASCRIPT ERROR]
錯誤詳細信息:TypeError: body is undefined
是否有可能在JSON中傳遞表?
這應該有效。您的問題必須在其他地方,例如使用數據。 –
你是如何尋找身體的? –
_What_說身體未定義?因爲這裏沒有你粘貼的代碼,這是肯定的。 – Amadan