我正在使用 ASP.NET我想將一些數(shù)據(jù)從 JS 發(fā)送到我的控制器(在數(shù)據(jù)庫(kù)中設(shè)置此日期)。我嘗試使用“fetch”,但對(duì)象為空。MyController 名稱(chēng):HomeController、我的操作:ResultPage、我要發(fā)送的數(shù)據(jù):testResultPS 我使用 System.Web.Http 中的 [FromBody];console.log(testResult); // have some datafetch('/Home/ResultPage', { method: 'post', body: JSON.stringify(testResult) })[System.Web.Mvc.HttpPost]public void ResultPage([FromBody] TestResult testResult){ // testResult is null //some code here}
如何從 JS 將參數(shù)發(fā)送到我的控制器 ASP 中?
喵喵時(shí)光機(jī)
2024-01-20 22:31:36