$ http.post差异$ .post

时间:2015-11-07 14:48:23

标签: jquery angularjs

首先,请检查以下图片:

enter image description here

左边的部分代表jquery的POST:

($.post("localhost:65066/Store/Browse2?QualificatifsIDs=483", { responseType: "json" })

右边是棱角分明的POST:

($http.post("localhost:65066/Store/Browse2?QualificatifsIDs=483", { responseType: "json" }))

左边的结果是预期的结果。为什么会有区别?

1 个答案:

答案 0 :(得分:0)

Jquery请求:Content-Type:application / x-www-form-urlencoded;字符集= UTF-8

Angular请求:Content-Type:application / json; charset = UTF-8

How do I POST urlencoded form data with $http in AngularJS?

您是否也希望有效负载中的响应类型或配置选项?

$http.post("localhost:65066/Store/Browse2?QualificatifsIDs=483", {}, { responseType: "json" })
相关问题