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>

  • 相关阅读:
    异步编程
    写代码写至最有面向对象味道
    GitHub上整理
    用CQRS+ES实现DDD
    前端开发
    让低版本的IE浏览器 强制渲染为IE8 或者 以上 浏览器模式
    NHibernate系列
    hadoop搭建开发环境及编写Hello World
    Linux date -s(转)
    即时编译和打包您的 Groovy 脚本(转)
  • 原文地址:https://www.cnblogs.com/myleave/p/12161926.html
Copyright © 2011-2022 走看看