Here are the steps:
Step 1: Verify you have Microsoft jQuery Unobtrusive Ajax in your script folder,
If not then install package using the following command in Nuget:
Install-PackageMicrosoft.jQuery.Unobtrusive.Ajax
You may refer the following link to
install.
Step 2: Create Controller, Model and View in your MVC application.
Step 3: Include the following two important script file in your project.
Step 4: Create Partial view which you want to update in the Ajax.Begin form submit button. You may add this at the end of BeginForm,
Step 5: Add
Ajax.BeginForm.
It has the following parameters:
- Action Name
- Controller Name
- AjaxOption (mention HttpMethod =post , UpdateTargetId = “Traget Div to update”.
My Ajax.BegineForm is like the following:
And My Final View is as below:
Hence you will get your
div with partial view updates on submit button using
Ajax.BeginForm.
On Submit button my partial view updates without postback.