【发布时间】:2014-08-16 19:02:06
【问题描述】:
当用户从主页面点击退出按钮时,cookies会被删除并重定向到window.location = url; .即使用户没有登录,而是点击注销,他们仍然会被重定向到 window.location = url;。我的代码如下,即使单击注销按钮,我似乎也无法注销,并且在登录时我将留在主页上。谁能告诉我出了什么问题?我是 JavaScript 新手,需要有关此主题的帮助。
$('.logout-btn').click(function(e){
e.preventDefault();
if(isset($_COOKIE['REFERER']) && $_COOKIE['REFERER'] != '') {
window.location = url;
}
else {
$.post(outurl, function( data ) {
}).then(function(r){
$('#popup_ok, .x-close').bind( "click", function() {
window.location = url;
});
if(r.result == 1){
popup_msg('Failed', r.msg);
}
else{
popup_msg('Success', r.msg);
setTimeout(function(){
window.location = url;
},2000);
}
});
}
});
【问题讨论】:
标签: javascript php cookies logout