I have code send a list of integers to the controller I use JQuery post and I want to replace it with fetch however my code not working correctly and I have no idea how to solve it my old code:
$.post(url, { ids: id });
code using fetch
var ids = new FormData();
ids.append('ids',id);
fetch(url, { method: 'POST', body: ids });
controller
[HttpPost]
public async Task<IActionResult> Create(int[] ids)
{
return Json(ids)
}
First method mapping correctly and the request object as shown in the image below
Second method request object:
