【发布时间】:2017-01-17 04:24:42
【问题描述】:
我正在通过 DELETE 方法发送密钥,但该方法似乎不合适。任何线索我错过了什么?该函数运行但它不起作用
$scope.delete = function(id) {
if (confirm("Are you sure you want to delete the user") === true) {
$http({
method: 'DELETE',
url: 'http://abc.dev/users/user/' + id,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.success(function(data) {
$scope.singleuser = data;
console.log("function single user is processed");
})
.error(function(data) {
console.log('error');
});
} else {
console.log("no");
}
};
【问题讨论】:
-
您使用的是哪个 Angular 版本?
-
服务器是否允许
delete方法?收到 403 响应了吗? -
什么不起作用?错误回调的成功都没有被调用吗?您是否在 JS 控制台中遇到任何错误?
-
@thepio 我正在使用 angular1
标签: javascript angularjs sql-delete