用ajax统计在线人数

<SCRIPT language=javascript>
function updatenumber(){
var url = "<%=path%>/manageuser.do?task=updatenumber";
new Ajax.Request(url, {  asynchronous:false, method:'post' ,onComplete: function(xmlHttp) {    
if (200 == xmlHttp.status)  {
document.getElementById("updatenumber").innerText=xmlHttp.responseText;
}else if(404 == xmlHttp.status){
alert("404");
}else if (500 == xmlHttp.status){
alert("500");
}
}});

}
setInterval(updatenumber, 1000);


<span id="updatenumber"></span>

你可能感兴趣的:(Ajax)