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>

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.