【发布时间】:2018-02-24 23:00:25
【问题描述】:
我有用数据填充表格的脚本。
这是我的查看代码
<div class="row" id="resultTable">
<table class="table">
<tr style="background:lightgrey">
<th class="title">Name</th>
<th class="title">Land</th>
</tr>
<tbody id="people" style="overflow-y: scroll;">
</tbody>
</table>
这是我的js函数代码
function GetPeople() {
let getpeopleurl = "/Home/GetPeopleInfo";
$.ajax({
type: 'GET',
url: getpeopleurl,
dataType: 'json',
sucess: function (data) {
let list = data;
for (let i = 0; i <= list.length - 1; i++) {
let peoplelist = '<td class="title">' + list[i].Name + '</td>'
+ '<td class="title"> ' + list[i].Land + '</td>';
$("#people").append(('<tr>' + peoplelist + '</tr>'));
};
}
});
}
我通过网络选项卡检查了它并获得了数据
这是截图
但我看不到 tbody 中的数据。我的麻烦在哪里?
【问题讨论】:
标签: javascript jquery html-table