All pastes #766927 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-09 09:10 UTC
rendered paste body
function read_chat (idAllarm)
{
	var elemento = gebi("chatRead");

		if (xhr_ch){
			//modifichiamo questa parte perch� andiamo a fare la chiamata
			xhr_ch.open("GET", "chat.php?idAllarm=" + idAllarm, true);
			xhr_ch.setRequestHeader("connection", "close");
			xhr_ch.send(null);
			xhr_ch.onreadystatechange=function(){
				if (xhr_ch.readyState===readyState.completato){
					if (statusText[xhr_ch.status]==="OK"){
					        clearTimeout(xhrTimeout);
						elemento.innerHTML = xhr_ch.responseText;

					}
				}
			}

		}

}


var xhrTimeout=setTimeout("ajaxTimeout();",5000);
function ajaxTimeout(){
   xhr_ch.abort();
}