MVC删除页面


@{
ViewBag.Title = "Order";
}

<h2>Order</h2>
<script src="~/Scripts/jquery-3.3.1.js"></script>
<script src="~/Scripts/bootstrap.js"></script>
<link href="~/Scripts/bootstrap.css" rel="stylesheet" />
<table class="table table-bordered">
<thead>
<tr>
<td>订单编号</td>
<td>订单人</td>
<td>下单时间</td>
<td>购买商品</td>
<td>商品价格</td>
<td>订单状态</td>
<td>操作</td>
</tr>
</thead>
<tbody id="body"></tbody>
</table>
<script>
GetOrder();
function GetOrder() {
var str = "";
str = JSON.parse(getCookie('user'));
$.ajax({
url: 'http://localhost:7202/api/Default/GetOrderShow',
type: 'get',
data: { username: str },
dataType: 'json',
success: function (d) {
$("#body").empty();
$(d).each(function () {
var strs = this.OZhuangtai == 0 ? "退款审核中" : "正常";
$("#body").append(
"<tr>" +
"<td>" + this.Oid + "</td>" +
"<td>" + this.Oname + "</td>" +
"<td>" + this.ShopName + "</td>" +
"<td>" + this.ShopPrice + "</td>" +
"<td>" + strs + "</td>" +
"<td><input type='button' value='退货' class='btn btn-danger' onclick='DeleteOrd(" + this.Oid + ")'/></td>" +
"</tr>"
)
})
}
})
}


function DeleteOrd(id) {
location.href = "http://localhost:8691/Default/DelOrder?OderId=" + id;
}


/**
* cookie中取值
* */
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); //匹配字段
if (arr = document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null;
}
}
</script>

posted @ 2020-07-09 20:30  jieModels  阅读(36)  评论(0)    收藏  举报