首先,您应该将返回的json 字符串 解析为json 对象 :
data = $.parseJSON(data);
然后,遍历它并创建表。完整的解决方案如下所示:
$('#btnGoNew').click(function () { var url = '@Url.Content("~/DoctorDetail/GetValue")'; $.getJSON(url, { id: valz }, function (data) { data = $.parseJSON(data); //pre to bind table $.each(data, function(i, item) { var html = "<tr><td>" + item.Location + "</td>"; html += "<td>" + item.Duration + "</td>"; // and html += other fields... $("#grd1 tr:last").after(html); // the above line is like that because you use <tbody> // in table definition. }); });});


