angular 默认使用的是application/json方式提交,如果需要兼容以前的老系统 需要这样更改 ,记录一下
$http({
method : 'POST',
url : url,
data : $.param(postData),
headers : {
'Content-Type' : 'application/x-www-form-urlencoded'
}
}).success(function(data) {
return ;
}
});</pre><br /><br />
本文介绍如何在Angular中调整HTTP POST请求的Content-Type,以便与旧系统兼容。通过设置正确的头部信息,可以将默认的application/json更改为application/x-www-form-urlencoded。
1万+

被折叠的 条评论
为什么被折叠?



