I have this simple script that keeps teasing me:
var latest;
function populate(){
$.get('lib/log.php?action=update&latest='+latest, function(data) {
if(data.id!=latest){
latest = data.id;
$(data.news).hide().prependTo('#tabul').slideDown("slow");
}
},"json")
setInterval(populate,5000);
};
populate();
- Every time the request fires it retrieves a single line of html, but it keeps adding it to the previous response, so it goes 1 line, 2 lines, 4 lines, 8, 16.. and so on.. the browser (and bandwidth) goes crazy...
Why is that? What am I missing and how do I just get it to prepend that single line only.
Thanks in advance
Andreas