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 關注
- 193 瀏覽
添加回答
舉報