2 回答
TA贡献1848条经验 获得超2个赞
问题是您刷新页面,而不是使用 ajax 获取内容。
<?php if ($user[ 'verified']) echo '<META HTTP-EQUIV="Refresh" Content="0; URL='.$location.'">'; ?>
当用户验证==真时,浏览器刷新,下次用户验证==真,当然,网站不断刷新。
因此,如果 $user 已验证,您应该触发 ajax 以获取新内容。
TA贡献1851条经验 获得超3个赞
我可以通过添加 JavaScript 来解决这个问题 document.location.reload(true)
$('.verify-account').click(function() {
$(this).prepend('<i style="margin-top:5px;margin-left:5px" class="fa fa fa-spinner fa-spin"></i> ');
$.post('verify', function(data) {
if (data.status == 'success') {
$('.accountver').html('<strong class="text-success"><i class="fa fa-check"></i> Verified</strong>');
$('.verify-account').html('<p1>Verified</p1>');
$('.verify-account').prop('disabled', true);
$('.verification').empty();
document.location.reload(true)
}
$('.verify-account').find('i').remove();
showAlert(data.status, data.message);
}).fail(function(response) {
$('.verify-account').find('i').remove();
showAlert('error', 'There was a problem while perform this action. '+ response.responseText);
});
});
- 2 回答
- 0 关注
- 180 浏览
添加回答
举报