首页 > 解决方案 > 无法将 Ajax 数据传递到 HTML 表中

问题描述

我无法使用 ajax 将数据传递给表。如果有人能弄清楚我在哪里做错了,那就太好了。非常感谢你。

阿贾克斯成功

  success: function(response){ 
    for(i = 0; i<response.list_reports.length;i++){
      console.log(response.list_reports[i])
      document.getElementById("paid_bys").innerHTML = response.list_reports[i]; // Error
    }
    $("#rports").modal('show');
    $("#rports").val(null).trigger("change");
  }

控制台输出

在此处输入图像描述

我尝试过的表(索引):1519 未捕获的类型错误:无法设置属性“innerHTML”为空

<table class="table table-striped table-bordered base-style">
    <thead>
            <tr>
                <th>Names</th>
            </tr>
        </thead>
        <tbody>

            <tr>
            <td><span id="paid_bys"></td> //display here
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <th>Name</th>
        </tr>
    </tfoot>                
</table>



                                

标签: javascriptpythonhtmlajax

解决方案


推荐阅读