【发布时间】:2013-12-17 21:52:23
【问题描述】:
我似乎无法使用 Angularjs 删除 cookie。有什么问题..她是代码..
$scope.adminLogout = function(){
$http({
url: '/AdServerLongTail/adminapi/logout',
method: "POST",
dataType:"json",
}).success(function (data, status, headers, config) {
console.log("success");
delete $cookies["username"];
delete $cookies["JSESSIONID"];
$rootScope.welcome=null;
$location.path("/admin");
}).error(function (data, status, headers, config) {
console.log("error");
});
}
html
<li><a href="#" ng-click="adminLogout()">LOGOUT</a></li>
【问题讨论】:
-
你遇到了什么错误?
-
我没有收到,只是没有删除它们
-
我在纯 javascript 上遇到了同样的问题。我必须删除 django bankend 中的会话,然后我才能成功注销。函数是
django.contrib.auth.views.logout(request)