how can I place an array for action on my controller with an anti-fake token.
This is my jquery post data:
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-fake token, and I wonder how I can use it with postdata.
This is a token object:
var token = { '__RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() };
Yours faithfully
source share