【问题标题】:Table isn't updating (JS)表格未更新(JS)
【发布时间】: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


    【解决方案1】:

    我发现了麻烦。

    打错字了。

    我写的是sucess,但它必须是success

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-05
      • 1970-01-01
      • 1970-01-01
      • 2015-06-19
      • 1970-01-01
      相关资源
      最近更新 更多