我有一段能很好地跨源工作的jQuery代碼:jQuery.ajax({ url: "http://example.appspot.com/rest/app", type: "POST", data: JSON.stringify({"foo":"bar"}), dataType: "json", contentType: "application/json; charset=utf-8", success: function (response) { console.log("success"); }, error: function (response) { console.log("failed"); }});現(xiàn)在,我試圖將其轉(zhuǎn)換為Angular.js代碼,但沒有成功:$http({ url: "http://example.appspot.com/rest/app", dataType: "json", method: "POST", data: JSON.stringify({"foo":"bar"}), headers: { "Content-Type": "application/json; charset=utf-8" }}).success(function(response){ $scope.response = response;}).error(function(error){ $scope.error = error;});任何幫助表示贊賞。
- 3 回答
- 0 關(guān)注
- 721 瀏覽
添加回答
舉報
0/150
提交
取消