I am using ASP.NET
I want to send some data into my controller (which set this date in DataBase) from JS. I have tried using "fetch" but object is null.
MyController name: HomeController,
My Action: ResultPage,
Data which I want to send: testResult
P.S I use [FromBody] from System.Web.Http;
console.log(testResult); // have some data
fetch('/Home/ResultPage',
{
method: 'post',
body: JSON.stringify(testResult)
})
[System.Web.Mvc.HttpPost]
public void ResultPage([FromBody] TestResult testResult)
{
// testResult is null
//some code here
}