Skip to content

Instantly share code, notes, and snippets.

@aaronmcadam
Created May 13, 2010 00:17
Show Gist options
  • Save aaronmcadam/399308 to your computer and use it in GitHub Desktop.
Save aaronmcadam/399308 to your computer and use it in GitHub Desktop.
ajax pagination
var $pagination = $("#demo1 ul");
$pagination.delegate('.jPag-current', 'click', function() {
var $$this = $(this);
$$this.closest('li').addClass('cached');
$pagination.find("#currentPage").removeAttr('id').wrapInner($('<a>', {'class':'pagenumbers', 'href':'book_data.php?keywords='+keywords}));
$$this.closest('li').attr('id','currentPage').html( $$this.text() );
$.ajax({
type : "GET",
cache : false,
url : "book_data.php",
data : { keywords : keywords, page : $$this.text() },
success : show_results
});
return false;
});
@aaronmcadam
Copy link
Author

Need to implement some sort of slicing, to manage page numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment