我有一个ajax类型的脚本,使用xmlhttp更改div内容和来自PHP文件的数据:
function updatelog() {
request = 'messages.php?new='+first+'&time='+lastupdate+'&user='+user;
xmlhttp.open("GET", request ,false);
xmlhttp.send();
document.getElementById("messages").innerHTML=document.getElementById("messages").innerHTML+xmlhttp.responseText;
lastupdate = time();
first = 0;
document.getElementById("messages-window").scrollTop = document.getElementById("messages-window").scrollHeight;
}
我想使用header( 'Location: kick.php' );
重定向用户,但它只重定向XML请求,而不是整个页面。
如何重定向整个页面而不仅仅是请求?
答案 0 :(得分:1)
使用javascript重定向
window.location =“kick.php”