Reloading new content while scrolling

Heedayerrog

New Member
Im using the following jQuery, which sets the id of the last item in a UL to 'last_item'.\[code\]function oldest() { j('ul li:last-child').addClass( 'last_item' ); oldestName = j('.last_item').attr('id'); alert('last ID is:'+ oldestName +'.');}j(window).scroll(function(){ if (j(window).scrollTop() == j(document).height() - j(window).height()){ j.ajax({ url: "older.php?oldest="+oldestName+"", cache: false, success: function(html){ j(".older").html(html); oldest(); } }) }}); oldest(); //Call function on page load$('.button2').click(function() { j('.older ul > *').clone().hide().appendTo('.tweets ul').slideDown(); oldest();});\[/code\]While scrolling older.php is called which contains:\[code\]$oldest = $_GET['oldest'];$getolder = mysql_query(" SELECT * FROM table where date < $oldest ORDER BY date DESC LIMIT 20");\[/code\]However what currently happens is the records from the database do get pulled back, stored in a hidden DIV. I then use the jQuery to add these records to the end of the list.However the next time i scroll to the bottom of the page and press the button, the same records are added to the lists.Can any help me to find out why this is?Essentially it seems $oldest isnt being updated with the new last UL item date.
 
Back
Top