我是jQuery的新手,我使用here的确认框。但是,在我确认我在对话框中注销之前,我正面临一个问题,即当前页面重定向回登录页面。在注销前添加jQuery确认
下面是我的脚本:
$('a#logout').on('click', function() {
var isConfirmed = $.confirm({
title: 'Logout Confirmation',
content: 'Are you sure you want to logout?',
buttons: {
confirm: function() {
// $.alert('Confirmed!');
return true;
},
cancel: function() {
// $.alert('Canceled!');
return false;
},
}
});
if(isConfirmed == true){
window.location.href="extra-login.html";
}
});
这是我的HTML
<a href="extra-login.html" id="logout"> Log Out <i class="entypo-logout right"></i> </a>
任何帮助,将不胜感激。提前致谢!
放重定向代码在确认回调和删除锚标记的href! –
'href =“extra-login.html”'to'href' – Sankar