ajax - Jquery code refreshing whole page instead of a part of a page -
$(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); } }); }
hi using code refresh files have put in wall system , getting file (main index file code used) show in block, purpose refresh block calling index file, code making favicon blink every few seconds , see browser showing waiting www.mywebsite.com every few seconds, how can fix update part of block , not whole page. hope makes sense first post here , thank in advance.
edited
tried update per suggestion doesn't work , know it's messed up
$(document).ready(
function update() { var letest_id = $("ul.pagination1 :first-child").attr('id').replace('record-',''); $.ajax({ method:'get', cache: false, url: '/themes/default/fbcommentstyle/latest_post.php?load_s=ajax&group_id=&max_id='+letest_id+'&ref=',
success: function(data){ if(data){ $('ul.pagination1').prepend(data).fadein('slow'); } }, error:function(){ cleartimeout(updatediv); } }); var comid = $('#last_id_ajax').val(); $.ajax({ method:'get', cache: false, url: '/themes/default/fbcommentstyle/latest_comment.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); $(divi).append(result).fadein('slow'); } }, error:function(){ cleartimeout(updatediv); } } 3000);
}
Comments
Post a Comment