您好我難以理解爲什麼我的表中的數據返回undefined。我想我很接近。 請看看我的jsfiddle:表json數據返回未定義使用jQuery
$(document).ready(function() {
$.getJSON("http://www.corsproxy.com/dvl.thomascooper.com/data/json_return.json", function(data) {
//static table head
$('table.stats').append("<th>" + "</th>" + "<th>" + "Date" + "</th>" + "<th>" + "Brand" + "</th>" + "<th>" + "Author" + "</th>" + "<th>" + "Title" + "</th>" + "<th>" + "Posts" + "</th>" + "<th>" + "Exposure" + "</th>" + "<th>" + "Engagement" + "</th>");
//loop through json data
$.each(data.data.rows,function(i, val){
//+1 to number each row starting at 1
var rowNum = i + 1;
//create table rows and cell and populate with data
$('table.stats').append( "<tr>" + "<td>" + rowNum + "</td>" + "<td>" + val.date + "</td>" +"<td>" + val.brand_id + "</td>" + "<td>" + val.author + "</td>" + "<td>" + val.title + "</td>" + "<td>" + val.posts + "</td>" + "<td>" + val.reach + "</td>" + "<td>" + val.interaction + "</td>" + "</tr>");
});
});
});
小提琴:http://jsfiddle.net/tommy6s/eLbq2wvh/
http://jsfiddle.net/eLbq2wvh/6/ – Luc 2014-11-23 00:47:37
標題行當然可以用'