Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax.ActionLink在其他页面上不起作用_Ajax_Asp.net Mvc 4 - Fatal编程技术网

Ajax.ActionLink在其他页面上不起作用

Ajax.ActionLink在其他页面上不起作用,ajax,asp.net-mvc-4,Ajax,Asp.net Mvc 4,当我在startpage上时,像这样的Ajax工作得很好,当我点击菜单时,它会用信息填充我的部分视图。但是,当我转到localhost:44300/以外的页面时,就像这一个,然后单击我的菜单,它就在同一个页面上,而不是转到我的局部视图。当我调试是正确的方法,并填写我的部分视图正确,但没有显示在我的主页上 我的菜单在局部视图上_menu.cshtml @model IEnumerable<ASPNetMarketplace.Models.MenuViewmodel> @foreach

当我在startpage上时,像这样的Ajax工作得很好,当我点击菜单时,它会用信息填充我的部分视图。但是,当我转到localhost:44300/以外的页面时,就像这一个,然后单击我的菜单,它就在同一个页面上,而不是转到我的局部视图。当我调试是正确的方法,并填写我的部分视图正确,但没有显示在我的主页上

我的菜单在局部视图上_menu.cshtml

@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());
        }