Below is the code for my WebAPI in C#:
[Route("")]
[HttpPost]
public void SaveTestRun([FromBody] object data)
{
inputResultsToDatabase(data);
}
This is the ajax request I am making:
sendTestData() {
this.get('ajax').request('/web/api/test/', {
data: {"name":"John Doe", "age":18, "country":"United States of America"},
method: 'POST',
dataType: 'object',
headers: {
AjaxRequestUniqueKey: getAntiForgeryToken()
}
});
},
When I check Google Developer Tools, the 'data' object is showing up as null. I have attempted to send the object as a string but am encountering the same issue.