zoukankan      html  css  js  c++  java
  • 前台界面(1显示,2添加)

    @{
        ViewBag.Title = "Show";
    }
    <h2>Show</h2>
    <script src="~/Scripts/jquery-3.3.1.js"></script>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <span>产品列表</span>
    <table class="table table-bordered">
        <thead>
            <tr>
                <td>编号</td>
                <td>产品名称</td>
                <td>价格</td>
            </tr>
        </thead>
        <tbody id="Body"></tbody>
    </table>

    <span>订单列表</span>
    <table class="table table-bordered">
        <thead>
            <tr>
                <td>编号</td>
                <td>订单号</td>
                <td>总价</td>
            </tr>
        </thead>
        <tbody id="BodyDan"></tbody>
    </table>
    <script>
        $(function () {
            ShowChanPin();
        })
        function ShowChanPin() {
            $.ajax({
                url: "http://localhost:62506/api/ChanPin",
                DataType: "json",
                type: "get",
                success: function (i) {
                    ShowDingDan();
                    $("#Body").empty();
                    var line;
                    $(i).each(function () {
                        line = '<tr>' +
                            '<td>' + this.Id + '</td>' +
                            '<td>' + this.Name + '</td>' +
                            '<td>' + this.Money + '</td>' +
                            '</tr>';
                        $("#Body").append(line);
                    })
                }
            })
        }
            function ShowDingDan() {
            $.ajax({
                url: "http://localhost:62506/api/DingDan",
                DataType: "json",
                type: "get",
                success: function (i) {
                    $("#BodyDan").empty();
                    var line;
                    $(i).each(function () {
                        line = '<tr>' +
                            '<td>' + this.Id + '</td>' +
                            '<td>' + this.DanHao + '</td>' +
                            '<td>' + this.SumMoney + '</td>' +
                            '</tr>';
                        $("#BodyDan").append(line);
                    })
                }
            })
        }
    </script>
  • 相关阅读:
    NAS与SAN RAID
    使用slice和concat对数组的深拷贝和浅拷贝
    使用JSON.parse(),JSON.stringify()实现对对象的深拷贝
    ng2父子模块通信@ViewChild和@Inject
    js避免命名冲突
    JSON.parse()和JSON.stringify()
    object类型转换为Array类型
    Angular 2 ViewChild & ViewChildren
    ElementRef, @ViewChild & Renderer
    ng2父子模块数据交互
  • 原文地址:https://www.cnblogs.com/gc1229/p/13139933.html
Copyright © 2011-2022 走看看