ASP.NET MVC Ajax.ActionLink's weird behavior
I'm doing the simplest ajax request possible:
public ActionResult SayHello()
{
return Content开发者_如何学C("YYAAAY");
}
//////////
<div id="Div1">
<%= Ajax.ActionLink("SAY HELLO", "SayHello", new AjaxOptions { UpdateTargetId = "Div1" })%>
</div>
It works when I start an empty ASP.NET MVC project, but when I use it in my current project, it displays the whole page recursively instead of YYAAAY phrase only.
Where might be the problem?
I suspect you have an unrelated javascript error that is causing it to use the default action (link) instead of retrieving the content via AJAX. Use Firefox/Firebug and examine the console or turn on script debugging in IE and see.
精彩评论