
1:用ajax的方式实现异步加载子页面:
- function MasterPageJump(Url) {
- $.ajax({
- url: Url,
- type: "GET",
- success: function (response) {
- $('#mainContent').html(response);
- }
- });
- }
- 把跳转路径传入Url中就可以了
-
-
- 2:母版页再加一个Id
-
- <div id="main">
- @RenderBody()
- </div>
-
-
-
- 3:子页面
@{
ViewBag.Title = "子页面";
Layout = Request.IsAjaxRequest() ? null : "~/Views/MasterPage.cshtml";
}
评价
饰心
这么多图片!这tm不报警o(╯□╰)o?
剑轩
天鸭,图是真的多......