wbuura
Last Updated: February 25, 2016
·
1.447K
· johnmills
Photo by peter jakubowski uwm photo services   201

Easy infinite jQuery pagination

$('.nextpagelink a').live('click',function(e){
    e.preventDefault();
    // Add some loading notification here if you like...
    $.get( $(this).attr('href'), function(data){
        $('.myresultsdiv').append( $(data).find('.myresultsdivcontents') ); // Find and append the result data
        $('.nextpagelink').replaceWith( $(data).find('.nextpagelink') ); // Keep the nextpagelink outside the results so not to F up the appending
    });
});
Say Thanks
Respond