1๐
โ
So I found the answer in this question:
How to send a list of int with jQuery to ASP.net MVC Default Model Binder
The solution is to use the option traditional=true
in the ajax call
var categories = [1,2,3];
$.ajax({
url : "/api/items/id",
type: 'POST',
traditional:true,
headers: {
'X-HTTP-Method-Override': 'PUT'
},
// Form data
data : {
'categories':categories
}
then the parameters are transfered correctly as a list.
});
๐คoverlii
Source:stackexchange.com