Make sure that the jquery.unobtrusive-ajax.js
script is referenced in your page. This is what AJAXifies all the output generated by the Ajax.*
helpers. Without this script you only get a standard <form>
element generated by the Ajax.BeginForm
with a bunch of data-*
attributes. The jquery.unobtrusive-ajax.js
script analyzes those data-*
attributes and subscribes to the submit
event of the form, canceling the default action of making a full postback and sending an AJAX request to the server based on the data-* attributes.
It's important to mention that this script must be included AFTER jquery.js because it depends on it.
Also you seem to have some file input in your form and your controller action is taking an HttpPostedFileBase
parameter. You should realize that you cannot upload files using an AJAX request and once you include this script your file uploads will simply stop working. In order to be able to upload files using AJAX you could either use some plugin such as jquery.form
and Blueimp file upload or you could directly use the new XMLHttpRequest
object that's built into modern browsers. The advantage of the plugins is that they do feature detection and will fallback to other techniques depending on the capabilities of the client browsers.