I am trying to refresh an iFrame with AJAX so the iFrame on my page doesn't blink. The code below works, but it's a major memory hog and it crashes the page after about 2 minutes. I'm trying to get this to work so it doesn't crash the page.
I'm using the iFrame which has a table in it and I want it to get the content every 2 seconds so it's updated. The AJAX code below is inside a page called table.php. I have this page (table.php) in an iFrame on my main page called dispatch1.php. The table id is "thistable".
<script>
function checkRequest(){
var interval = setInterval(function(){
var request = $.ajax({
url: "table.php",
type: "post",
datatype: "html"
});
request.done(function(msg){
$("#thistable").html(msg);
});
},2000)
}
</script>