javascript - I want a div to refresh automaticallywithout refreshing whole page -
i have developed comment system ajax , working fine. want add ajax/js code refresh time ago div after every 5 seconds time changes while 1 on same post.
please note:
sir, want code request server refresh div after specific time period. not want load page or div want contents within div should refreshed after specific period of time.
i'm new in js/ajax , ii tried not working yet
$(document).ready(function () { setinterval(function () { $("#showtimeago!").load(); }, 1000); });
result want is:
<div class="p_timeago" id="showtimeago"> <?php time_stamp($timepost);?></div>
can me solve issue?
i don't know ui using, here php(since jquery same) can tune requirement.
function loadlink(){ $('#showtimeago').load('test.php',function () { $(this).unwrap(); }); } loadlink(); // run on page load setinterval(function(){ loadlink() // run after every 5 seconds }, 5000);
try this:
<div id="showtimeago"></div> setinterval(function(){ $('#showtimeago').load('test.php'); },5000);
test.php page refresher stand.
Comments
Post a Comment