Submitting a razor form using JQuery AJAX in MVC6 using the built-in functionality

后端 未结 3 1912
无人共我
无人共我 2020-12-22 19:49

I would like to know if there is a specific way to submit a form using jQuery AJAX in MVC6, still using the Auto Binding features of ASP.NET MVC. I believe in other versions

3条回答
  •  無奈伤痛
    2020-12-22 20:02

    Here's a really nice YouTube tutorial on AJAX forms, and you can download the project from this GitHub link. It contain the script to be used for AJAX.

    Sample style copied from the above project:

    @Html.Label("Name")

    @Html.TextBox("Name","",htmlAttributes:new { @class="form-control",id="Name"})

    @Html.Label("Age")

    @Html.TextBox("Age", "", htmlAttributes: new { @class = "form-control", id ="Age" })

提交回复
热议问题