Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Adding Ajax pagination?


Fotiman - 7:11 pm on Feb 6, 2013 (gmt 0)


Using the info I included previously, you have enough info to calculate the total number of pages:

var numOfPages = Math.ceil(totalRecords / pageSize);


You can use that to generate links:

var i,
pageLinks = '<div class="pageLinks">';
for (i = 0; i < numOfPages; i++) {
pageLinks += '<a href="#" onclick="showToyPage(' + i + ');return false;">' + (i + 1) + '<\/a> ';
}
pageLinks += '<\/div>';

Then append that where appropriate (probably before the data):

$('#info').html(pageLinks + data);
showToyPage(0);


Thread source:: http://www.webmasterworld.com/javascript/4541861.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com