...

View Full Version : Automatic refresh every minute



SoS
11-07-2010, 02:32 PM
Hello.
I'm using a modified version of http://www.javascriptkit.com/dhtmltutors/ajaxticker/ajaxticker4.shtml
and i need that the rss_ticker.prototype.getAjaxcontent get the content every minute.
Could someone helps me?
Thank you,
Sebi

sybil6
11-11-2010, 07:18 PM
with plain Js you need something like this:



function xhr(){
var xmlHttp=null;
try{xmlHttp=new XMLHttpRequest();}
catch (e){
try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

var retrieve = new xhr();
function _retrieve(){
retrieve.open("GET","questions_ajax.php?", true);
retrieve.setRequestHeader('If-Modified-Since','Wed, 05 Apr 2006 00:00:00 GMT');
retrieve.send(null);
retrieve.onreadystatechange = function(){
if (retrieve.readyState == 4 && retrieve.status == 200) {
response= retrieve.responseText
document.getElementById('output').innerHTML = retrieve.responseText;
window.setTimeout('_retrieve();',1000)
//alert(response.length)

}
}
}

onload=function(){
_retrieve()

}

then in questions_ajax.php you have your database query.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum