zoukankan      html  css  js  c++  java
  • 利用js在Table中追加数据

    <div >
        <table id="divData" class="table-bordered table"  style="margin-top:20px">
            <tr id="wahha">
            <td>编号</td>
            <td>类型</td>
                <td>操作</td>
            </tr>

        </table>
    </div>
    <script>

        window.onload = function LoadFun() {
            $.ajax({
                url: 'https://localhost:44374/api/carinfo/gettype',
                type: 'get',
                success: function (d) {
                    console.log(d);
                    var a = "";
          
                    $(d).each(function () {
                        a += '<tr><td>' + this.Id + '</td> <td>' + this.CarTypeName + '</td><td><input id="button1" type="button" value="删除" class="btn-link btn" style="color:red" onclick="fun1('+this.Id + ')"/><input id="button1" type="button" value="修改" class="btn-link btn" style="color:blue" onclick="fun2('+this.Id + ')"/></td> </tr>';
                    })
                    console.log(a);
                    $("#divData").append(a)
                }
            })
        }
    </script>

  • 相关阅读:
    使用setTimeout()代替setInterval()
    音视频入门-02-RGB拼图
    音视频入门-01-认识RGB
    CMake入门-04-自定义编译选项
    CMake入门-03-还是HelloWorld
    CMake入门-02-HelloWorld扩展
    CMake入门-01-从HelloWorld开始
    HTML页面启动sass监听编译成css文件
    安装+配置Express
    安装+配置Nginx
  • 原文地址:https://www.cnblogs.com/myleave/p/12161926.html
Copyright © 2011-2022 走看看