I have ajax request that sends data to my controller , it collects value of my dropdown
the error is
POST http://localhost:65070/form/create 500 (Int
Your post method must have the [ValidateAntiForgeryToken]
attribute. Either remove the attribute or in the view, add the token
@Html.AntiForgeryToken()
and pass it back in the ajax function
$('#State').change(function () {
var a = $('#State').val();
var token = $('[name=__RequestVerificationToken]').val();
$.ajax({
....
data: { __RequestVerificationToken: token, 'SubID': a },
....
Note the form
parameter is not necessary in the action method
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(int SubID)
{
....