我试图使用put方法在HTTP angularJS我得到一个错误HTTP PUT方法AngularJS不工作与头
错误:XMLHttpRequest的无法加载[URL]。为预检响应具有无效的HTTP状态代码404
我的代码是:
var newRentalUrl = serverURL;
var dataObj = JSON.stringify(JSONDATA);
$http.put(newRentalUrl, dataObj, {
headers: {
'Content-Type': 'application/json; charset=UTF-8'
},
}).success(function(responseData) {
try {
$ionicLoading.hide();
console.log(responseData);
//$state.go('payment');
} catch (err) {
console.log(err);
$ionicLoading.hide();
}
$ionicLoading.hide();
}).error(function(data, status, headers, config) {
$ionicLoading.hide();
console.log(data);
});
在服务器端中,该方法被接收作为选项
2015-10-21T05:37:02.947517 +00:00 heroku [router]:at = info method = OPTIONS path =“/ v1/home/xx”host = xxxxxx.herokuapp.com request_id = xxxxx-498d-4026-a39a-xxxxxxx fwd =“xxx。 “xxxx.xxx.xxx” dyno = web.1 connect = 0ms service = 2ms status = 404 bytes = 481
您是否研究过错误以了解其含义? – charlietfl
是的,我做了,这个错误是put方法没有赶上服务器。 – kapilkarda