-
November 10th, 2008, 10:37 AM
#1
Ajax autoreferesh works fine with FireFox but doesn't work with IE
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...
Code:
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);
}
Last edited by PeejAvery; November 10th, 2008 at 02:44 PM.
-
November 10th, 2008, 02:49 PM
#2
Re: Ajax autoreferesh works fine with FireFox but doesn't work with IE
Why do you have || xmlHttp.readyState=='complete' to check for the state of the request? Take that part out since the readyState will always return a number.
Also, why are you returning true for the function before you can even sent the request? I would suggest removing the return as well.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|