ASP.NET Core and JQuery unobtrusive AJAX not working

拥有回忆 提交于 2019-12-03 03:01:38

While the Ajax.BeginForm() methods do not work, the actual unobtrusive Ajax html does. The C# methods just help generate the Html form tags. Forgive me in thse syntax is wrong, this is from memory, but you get the idea

@using (Ajax.BeginForm("EmployeeMaster", "Home", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "divEmp" }))
{
    //form content
}

becomes

<form asp-action="EmployeeMaster" asp-controller="Home" method="POST" data-ajax="true" data-ajax-update="divEmp">
    <!-- form content-->
</form>

NOTE: The above HTML STILL needs the unobtrusive ajax js files for it to wire up these data-* attributes correctly. This is not a part of ASP.NET Core MVC

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!