I am trying to use put method in http angularJS i am getting an error
Error : XMLHttpRequest cannot load [url]. Response for preflight has invalid HTTP status code 404
My Code is :
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);
});
On the server side, the method is received as options
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