PDA

View Full Version : Resolved AJAX or javascript reload command


auriaks
03-11-2010, 10:01 PM
Hi,

I have a function doWork() which I want to trigger automatically in every 3 seconds. Now, I use
<input type="text" onkeyup="doWork();" name="inputText" id="inputText" />
but I don't want to push the button or write a letter every time. I need it to work automatically...


function doWork(){
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open("GET", "middle_content.php", true);
httpObject.send(null);
httpObject.onreadystatechange = setOutput;
}
}

Thanks

rnd me
03-12-2010, 12:10 AM
setInterval(doWork, 3000)