• 前台界面(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>
  • 相关阅读:
    Apache与Nginx的优缺点比较
    [PHP基础]有关isset empty 函数的面试题
    PHP求解一个值是否为质数
    15个魔术方法的总结
    对象在类中的存储方式有哪些?
    cookie大小
    Tp3.2 和 Tp5.0之间的区别
    经典的面试题,(这是著名的约瑟夫环问题)
    怎么计算数据库有多大的数据量
    [置顶] 实用电子电路设计丛书
  • 原文地址:https://www.cnblogs.com/gc1229/p/13139933.html
Copyright © 2020-2023  润新知