I have the following index view:
@model BoringStore.ViewModels.ProductIndexViewModel
@{
ViewBag.Title = \"Index\";
}
Produkte
<
Don't include scripts inside your partial views! They should go the your "main" views or your _layout.cshtml
.
Your problem is that you have included the jquery.unobtrusive-ajax.min.js
twice in your page. Once in your Create
partial and once somewhere else. Because if you include that script multiple times it will subscribe on the submit event multiple times so you will get multiple submit with a single click.
So make sure that you have include that script only once in a page. So move the jquery.unobtrusive-ajax.min.js
reference into your index view.
insure that you dont have jquery.unobtrusive-ajax.min.js
file duplicated in the layout
as mentioned above, and you can check this using browser Inspectors
Another problem which may cause this error that i have encountered is resting a form using jquery in the ajax request as following
$("form").trigger("reset"); //just remove this line