raza_amir
November 10th, 2008, 09:37 AM
hi I am using the following code for refreshing a div through ajax, it works fine FireFox but doesn't work at all with IE. Infact the function is called after every 10 seconds but it doesn't send the call to server while using IE. Can anyone will help me out please...
function startTimer(sessionId, jsPageRefreshInterval){
param = "refreshInterval";
// alert(param + " = " + refreshInterval + " = " + sessionId + " = " + jsPageRefreshInterval);
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.open("GET","JobControllerUtilServlet?" + "sessionId=" + sessionId + "¶mChanged=true¶m=" + param + "&value=" + refreshInterval, true);
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4 || xmlHttp.readyState=='complete')
{
document.getElementById('theTable').innerHTML = xmlHttp.responseText;
dkc=setTimeout("startTimer('" + sessionId + "', '" + jsPageRefreshInterval + "');", 10000);
return true;
}
}
xmlHttp.send(null);
}
function startTimer(sessionId, jsPageRefreshInterval){
param = "refreshInterval";
// alert(param + " = " + refreshInterval + " = " + sessionId + " = " + jsPageRefreshInterval);
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.open("GET","JobControllerUtilServlet?" + "sessionId=" + sessionId + "¶mChanged=true¶m=" + param + "&value=" + refreshInterval, true);
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4 || xmlHttp.readyState=='complete')
{
document.getElementById('theTable').innerHTML = xmlHttp.responseText;
dkc=setTimeout("startTimer('" + sessionId + "', '" + jsPageRefreshInterval + "');", 10000);
return true;
}
}
xmlHttp.send(null);
}