首页 > 其他 > 详细

。。。

时间:2020-06-16 14:10:13      阅读:46      评论:0      收藏:0      [点我收藏+]
@{
    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>

。。。

原文:https://www.cnblogs.com/gc1229/p/13139933.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!