Hi,
I'm using the below code in order to increase the number of results that my php/mysql pulls-in through a 'more' button.
My question is: Can I add a jquery cookie so that when the 'more' button is pressed, and more results are loaded, the current state is saved?
The results in question are listed elements which contain links to their respective article. The only problem is that when you view an article from the 'more' results, and then go back to the listed results page, the results that were brought in by the ajax (more-press.php) are gone : (
Hence my question. Hope it makes sense. Thanks in advance. S.
$(document).ready(
function(){
$(function() {
//More Button
$('.more').live("click",function()
{
var ID = $(this).attr("id");
if(ID)
{
$("#more"+ID).html('<img src="images/more_press.gif" alt="More results..." />');
$.ajax({
type: "POST",
url: "more_press.php",
data: "lastmsg="+ ID,
cache: false,
success: function(html){
$("div#updates").append(html);
$("#more"+ID).remove();
}
});
} else {
$(".morebox").html('<p><strong>No more results...</strong></p>');
}
return false;
});
});
})
Edit: Also have this related post - Question 2