Hi I am using this code to refresh files I have put in a wall system and then I am getting this file (main index file where this code is used) to show up in a block, My purpose was to only refresh the block where i am calling index file, but this code is also making favicon to blink every few seconds and i also see the browser showing waiting for www.mywebsite.com every few seconds, how can I fix it to only update the part of block and not the whole page. I hope this makes sense as this is my first post here. How can edit this code to use setTimeout may be? Thank you in advance
$(document).ready(function () {
interval = setInterval(updateDiv, 1000); }); function updateDiv() {
var letest_id = $("ul.pagination1 :first-child").attr('id').replace('record-', '');
$.ajax({
method: 'GET',
cache: false,
url: 'url.php?load_s=ajax&group_id=<?php echo $g_i_s;?>&max_id=' + letest_id + '&ref=<?php echo time();?>',
success: function (data) {
if (data) {
$('ul.pagination1').prepend(data).fadeIn('slow');
}
},
error: function () {
clearInterval(interval);
}
});
var comid = $('#last_id_ajax').val();
$.ajax({
method: 'GET',
cache: false,
url: 'url.php?group_id=<?php echo $g_i_s;?>&commentid=' + comid + '&ref=<?php echo time();?>',
success: function (result) {
if (result) {
var divi = $(result).find(".imgd").attr('alt');
var last_id_ajax_val = $(result).find(".cid").attr('id');
$('#last_id_ajax').val(last_id_ajax_val);
// alert(newcoment);
$(divi).append(result).fadeIn('slow');
}
},
error: function () {
clearInterval(interval);
}
}); }