Man*_*uHH 1 javascript php ajax jquery
现在我已经困惑了一段时间了.我在jquery/ajax中得到了它的一部分:
<script type="text/javascript">
$(document).ready(function(){
jQuery.ajax({
type: "GET",
url: "sessioncheck.php",
dataType:"json",
success:function(response){
if (response) {
window.location.href = 'logout.php';
}
else {
// Process the expected results...
}
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
这很好用,但我希望这个过程每30秒重复一次.有人可以帮我吗?我已经阅读了有关setinterval的内容,但我似乎无法让它工作.
非常感谢您的所有帮助!
Bar*_*mar 10
$(document).ready(function(){
setInterval(function() {
jQuery.ajax({
type: "GET",
url: "sessioncheck.php",
dataType:"json",
success:function(response){
if (response) {
window.location.href = 'logout.php';
}
else {
// Process the expected results...
}
}
});
}, 30000);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5752 次 |
| 最近记录: |