.net core3.1 mvc post 请求(ajxa)
2021-01-21 16:13
标签:enc javascrip function throw png starty www status ica 最近在做.net core3.1 mvc post请求时,发现post参数数据一直获取不到,经过多方查阅发现请求时要加 contentType: "application/x-www-form-urlencoded",并且后台要加[FromForm]。 .net core3.1 mvc post 请求(ajxa) 标签:enc javascrip function throw png starty www status ica 原文地址:https://www.cnblogs.com/ATtuing/p/13292687.html问题
示例如下:前端
$.ajax({
url: "/DataMap/GetData",
type: "POST",
contentType: "application/x-www-form-urlencoded",
async: true,
dataType: "json",
data: { taskPage: { StartYear: startYear, EndYear: endYear, Page: pagenum, Limit:pagelimit,Types: types, MultiPolygonJson: multiPolygonJson, PointJson: pointJson } },
success: function (data) {
console.log(data);
}, error: function (XMLHttpRequest, textStatus, errorThrown) {
}
});
后端
[HttpPost]
public async Task
断点调试
上一篇:判断是否为AJAX请求
下一篇:PHP代码审计分段讲解(9)
文章标题:.net core3.1 mvc post 请求(ajxa)
文章链接:http://soscw.com/index.php/essay/45042.html