私は setTimeout を取得して、15秒後に内部にある関数を再実行しようとしています.15秒待っているのではなく、一定のループで実行しています。
これが私の現在のコードです
function checkSession(x) {
http.abort();
http.open("GET", siteURL+"processes/ajax.php?call=check_session&string="+x+"&new="+Math.random(), true);
http.onreadystatechange = function() {
if(http.readyState == 4) {
if(http.responseText == true) {
updateSession(x);
} else {
setTimeout(checkSession(x),15000);
}
}
}
http.send(null);
}
コード自体に問題はありません。唯一の問題は、「15000」ミリ秒待たずに一定のループを実行していることです。