Hello,
how do I post an array to an action on my controler with the anti forgery token.
This is my Jquery postdata:
var postData = { '__RequestVerificationToken': $('input[name=__RequestVerificationToken]').val(), 'productIds': IDs };
this is my Jquery post:
$.post("MyProducts/DeleteProduct" , postData, function(data) { });
This is my action:
public void DeleteProduct(List<int> productIds)
{
foreach (int i in productIds)
{
_repository.DeleteProduct(i, null);
}
}
I also use an object to store my anti forgery token and I wonder how I can use that with the postdata.
This is the token object:
var token = { '__RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() };
Kind regards