Jump to content

why my div content is not refreshing by ajax in ie


phpmady

Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<script type="text/javascript">

function Ajax(){

var xmlHttp;

try{

xmlHttp=new XMLHttpRequest();// Firefox, Opera 8.0+, Safari

}

catch (e){

try{

xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer

}

catch (e){

    try{

xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

}

catch (e){

alert("No AJAX!?");

return false;

}

}

}

 

xmlHttp.onreadystatechange=function(){

if(xmlHttp.readyState==4){

document.getElementById('content').innerHTML=xmlHttp.responseText;

setTimeout('Ajax()',1000);

}

}

xmlHttp.open("GET","data.php",true);

xmlHttp.send(null);

}

 

window.onload=function(){

setTimeout('Ajax()',1000);

}

</script>

 

</head>

 

<body>

 

<div id="content">

<?php echo " test the content div"; ?>

</div>

</body>

</html>

Hi friend,

 

actually I have 10 records in the table, i am trying to access all those 10 records to show, but in IE8, i am not getting all the 10 records,

 

Its good in FF and Chrome...

 

 

In Recent searches i came to know that, i have a memory leak problem with ie.

 

Thanks my friend,  if you can , please give me some solution.

 

Thanks a lot

 

Hi phpmady,

You use the word "refresh", which could indicate that you need to use setInterval rather than setTimeout?

 

Please see http://www.phpfreaks.com/forums/index.php?topic=327711.0, which I managed to work out for my own regularly-updating div issue...

 

If you add a unique identifier in the URI of the data.php call (like a current timestamp, generated by javascript , something like that) then the recurring call will not be cached as it has a unique value in the URI being called.

 

Just a thought.

WoolyG

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.