Skip to main content
1 of 2
Sofija
  • 733
  • 11
  • 14

In case someone would need - to achieve same or similar thing(like delete) via POST instead of FromUri, use FromBody and on client side(JS/jQuery) format param as $.param({ '': categoryids }, true)

c#:

public IHttpActionResult Remove([FromBody] int[] categoryIds) 

jQuery:

$.ajax({ type: 'POST', data: $.param({ '': categoryids }, true), url: url, //... }); 

The thing with $.param({ '': categoryids }, true) is that it .net will expect post body to contain urlencoded value like =1&=2&=3 without parameter name, and without brackets.

Sofija
  • 733
  • 11
  • 14