MVC显示界面
@{
ViewBag.Title = "HomePageIndex";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>HomePageIndex</h2>
<script>
$(function () {
DataBound();
})
//商品列表
function DataBound() {
$.ajax({
url: "http://localhost:57190/api/Sale/GetGoodsInfos",
type: "get",
dataType: "json",
success: function (d) {
var str = "";
$("#DataRow").empty();
$(d).each(function (i, n) {
str += "<div style='float:left;margin-left:20px'><input id='GId' type='hidden' value='" + n.GId + "'/><img src='http://localhost:57190" + n.GImg + "' width='60px' height='60px'/><br/> <a href='/Sale/GoodsInfoDetailIndex?GId=" + n.GId + "''><lable>" + n.GName + "</lable></a></div>"
})
$("#DataRow").append(str);
}
})
}
//跳转到我的订单页面
function SkipOrdersInfoIndex() {
location.href = '/Sale/OrdersInfoIndex';
}
</script>
<a href="javascript:SkipOrdersInfoIndex()">我的订单</a>
<div id="DataRow" style="width: 100%;height: 100%">
</div>