weixin_33737774 2018-11-19 13:18 采纳率: 0%
浏览 32

通过列表ajax加载表

I'm trying to load a table via post ajax, but it's not loading properly.

table:

<table class="table table-responsive table-hover table-striped" id="tableestoque" style="font-size:12px;">
                <thead>
                    <tr>
                        <th>Nome Empresa</th>
                        <th>Qtd</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>

And here is how I am loading:

$.each(data.listaEstoque, function (i, item) {
                $("#tableestoque").append("<tr"
                    + "<td>" + item.empresaProduto.nome + "</td>"
                    + "<td>" + item.qtd + "</td>"
                    + "</tr>")
            });

enter image description here

It is loading like this, I want you to load each one into a column, and if you have more rows, each in a row.

  • 写回答

2条回答 默认 最新

  • weixin_33739646 2018-11-19 13:22
    关注

    It looks like you need to append your html to <tbody> like this:

    $.each(data.listaEstoque, function (i, item) {
                    $("#tableestoque tbody").append("<tr"
                        + "<td>" + item.empresaProduto.nome + "</td>"
                        + "<td>" + item.qtd + "</td>"
                        + "</tr>")
                });
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常