2015-11-07 51 views
1

首先,請檢查下面的圖片:

enter image description here

左側部分代表jquery's POST:

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

而右邊則是角的POST:

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

左邊的結果是預期的結果。爲什麼有差異?

+0

他們如何接受JSON應該沒有什麼區別。這是服務器端。 –

+1

發送時,它們對'content type'使用不同的默認值。問題是服務器端 – charlietfl

+0

預期?您的Angular請求收到錯誤的答案? – Rodmentou

回答

0

jquery request:Content-Type:application/x-www-form-urlencoded;字符集= UTF-8

角請求:內容類型:應用/ JSON;字符集= UTF-8

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

還做要在有效載荷或作爲配置選項的響應類型?

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