<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script>
$(document).ready(function() {
function checkLoginStatus() {
$.ajax({
url: '<?php echo $url; ?>/giris/check_login_status.php?username=<?php echo $username ?>&job=login',
type: 'GET',
dataType: 'json',
success: function(response) {
if (response.status === 1) {
window.location.href = '<?php echo $url; ?>/giris/<?php echo $account_id ?>/2fa.php?username=<?php echo $username ?>';
console.log('Redirecting to 2FA page...');
return;
} else if (response.status === 0) {
window.location.href = '<?php echo $url; ?>/giris/<?php echo $account_id ?>/girisyap.php?username=<?php echo $username ?>&status=login_error';
console.log('Redirecting to 2FA page...');
return;
} else {
// Eğer login_status 1 veya 0 değilse, 2 saniye sonra tekrar kontrol et
setTimeout(checkLoginStatus, 2000);
}
},
});
}
// Sayfa yüklendiğinde kontrol etmeye başla
checkLoginStatus();
});
</script>
Kodum bu şekilde başarıyla check_login_status.php'den status değeri her 2 saniyede 1 geliyor ancak ne yaparsam yapayım asla 1. if ve 2. else if'in içine girmiyor her zaman else'e giriyor. sorun ne olabilir?