Skip to content

Instantly share code, notes, and snippets.

@DeskWOW
Forked from tstachl/mycases.js
Last active August 29, 2015 14:09
Show Gist options
  • Save DeskWOW/13d96a8f4ba9e5e61a69 to your computer and use it in GitHub Desktop.
Save DeskWOW/13d96a8f4ba9e5e61a69 to your computer and use it in GitHub Desktop.
(function($) {
function nextPage(url, callback) {
$.get(url, function(data, textStatus, jqXHR) {
var cases = $(data).find('.mycases tbody tr')
, nextUrl = $(data).find('#pagination a.next_page');
callback(cases);
if (nextUrl && nextUrl.attr('href')) nextPage(nextUrl.attr('href'), callback);
}, 'html');
}
var nextUrl = $('#pagination a.next_page');
if (nextUrl && nextUrl.attr('href')) {
nextPage(nextUrl.attr('href'), function(cases) {
$('.mycases tbody').append(cases);
});
$('#pagination').hide();
}
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment