Hello,
I am new to the ajax methodology so please bear with me.
I have implemented a javascript poll, every second, to my java servlet for message board data. Upon return, I display this data in some div on the jsp page. I noticed in Firefox this works, but in IE, unless I change my "check for new versions of stored pages" to "every time i visit" under tools/internet options/settings, the page divs do not update.
Obviosuly I must be doing something wrong, because the client shouldnt have to adjust browser settings. Any advice would be appreciated.
below is my code...
I am new to the ajax methodology so please bear with me.
I have implemented a javascript poll, every second, to my java servlet for message board data. Upon return, I display this data in some div on the jsp page. I noticed in Firefox this works, but in IE, unless I change my "check for new versions of stored pages" to "every time i visit" under tools/internet options/settings, the page divs do not update.
Obviosuly I must be doing something wrong, because the client shouldnt have to adjust browser settings. Any advice would be appreciated.
below is my code...
Code:
function pollServlet(){
//alert("in")
var xmlHttp;
try{ // Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}catch (e){ // Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
//document.add.message.value=document.add.message.value+" "+xmlHttp.responseText;
//document.getElementById.crap.value=xmlHttp.responseText;
document.getElementById("contentarea").innerHTML=xmlHttp.responseText
//alert(xmlHttp.responseText)
}
}
xmlHttp.open("GET","blogEntry",true);
xmlHttp.send(null);
init();
}
function init(){
setTimeout("pollServlet()",3000);
}
<body onload=init()>