开发者

PHP is not called properly in IE using set interval function in Javascript

开发者 https://www.devze.com 2022-12-27 01:17 出处:网络
I am trying to show the message updated in DB using the following code var showtime = setInterval(\'redirect()\',5000);

I am trying to show the message updated in DB using the following code

var showtime = setInterval('redirect()',5000);
////Redirecti开发者_运维问答ng to DB Status /////
function redirect()
{   
 xmlhttp = GetXmlHttpObject();
 if (xmlhttp==null)
    {
     alert ("Browser does not support HTTP Request");
     return;
    }
    var url="isResultexist.php"
    xmlhttp.onreadystatechange=stateChanged;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

I am collecting the response from PHP here and using it to update the Messages on UI Problem here is it works fine 1st time when it called after 5sec but there after return the Same result even DB is updated,

This works fine with Mozilla and google chrome browser

regards hemant


the IE is caching the response, so try to set an expires-header in your isResultexist.php, add a random parameter to each request or switch from get to post (post isn't cached).

0

精彩评论

暂无评论...
验证码 换一张
取 消