Ajax.ActionLink在其他页面上不起作用
当我在startpage上时,像这样的Ajax工作得很好,当我点击菜单时,它会用信息填充我的部分视图。但是,当我转到localhost:44300/以外的页面时,就像这一个,然后单击我的菜单,它就在同一个页面上,而不是转到我的局部视图。当我调试是正确的方法,并填写我的部分视图正确,但没有显示在我的主页上 我的菜单在局部视图上_menu.cshtmlAjax.ActionLink在其他页面上不起作用,ajax,asp.net-mvc-4,Ajax,Asp.net Mvc 4,当我在startpage上时,像这样的Ajax工作得很好,当我点击菜单时,它会用信息填充我的部分视图。但是,当我转到localhost:44300/以外的页面时,就像这一个,然后单击我的菜单,它就在同一个页面上,而不是转到我的局部视图。当我调试是正确的方法,并填写我的部分视图正确,但没有显示在我的主页上 我的菜单在局部视图上_menu.cshtml @model IEnumerable<ASPNetMarketplace.Models.MenuViewmodel> @foreach
@model IEnumerable<ASPNetMarketplace.Models.MenuViewmodel>
@foreach (var menuitem in Model)
{
<li>
@Ajax.ActionLink(menuitem.Name, "ListingIndex", "Home", new { id = menuitem.MenuId }, new AjaxOptions { UpdateTargetId = "result" })
<ul>
@if (menuitem.Children != null)
{
{
Html.RenderPartial("_Menu", menuitem.Children);
}
}
</ul>
</li>
}
两个局部视图都位于共享文件夹中
希望有人能帮助我。您是否已将jquery.unobtrusive-ajax.js添加到布局中?是的,在bootstrap中的my\u layout.cshtml上
public ActionResult ListingIndex(int? id)
{
var model = (from s in listingsRepository.AllIncluding() where s.CategoryId == id select s);
//Comes from menu
return PartialView("_ListingCategoryIndex", model.ToList());
}