更新时间:2023-12-02 11:09:46
您应该使用(.content)而不是(#content)
实施@Stephen答案:
Implementing @Stephen answer:
布局页面:
<script>
$(document).ready(function () {
//Select (AddCustomer) link specifically
$("#AddCustomer").click(function (e) {
$('.content').load("/Customer/AddCustomer");
return false;
});
});
</script>
<li class="treeview">
<a href="#">
<i class="fa fa-users"></i>
<span>Customer</span>
</a>
<ul class="treeview-menu">
<li><a id="ViewCustomer" href="/Customer/CustomerDetails"> <i class="fa fa-angle-double-right"></i>View Customer</a></li>
<li><a id="AddCustomer" href="/Customer/AddCustomer"> <i class="fa fa-angle-double-right"></i>Add Customer</a></li>
</ul>
</li>
<div class="content">
@RenderBody()
</div>
在addcustomer操作方法中:
In addcustomer action method:
public ActionResult AddCustomer()
{
return View("addcustomer");
}