【发布时间】:2011-06-03 11:16:10
【问题描述】:
我正在尝试在我的 ASP MVC3 应用程序中使用 ajax,但我遇到了问题。
这是我的视图代码:
@Html.Partial("_Topic", Model)
@Ajax.ActionLink("Afficher les commentaires", "ShowLastArticleComments",
new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "showComments",
InsertionMode = InsertionMode.Replace
})
<div id="showComments">
</div>
}
这是我的控制器方法:
public PartialViewResult ShowLastArticleComments()
{
blablabla
return PartialView("_Comments", comments);
}
当我点击 ajaxed 链接时,它会加载一个全新的页面,而不是仅仅用名为“_Comments”的 PartialView 替换 div。为什么?
谢谢,
风筝
【问题讨论】:
标签: asp.net-mvc-3 view controller