Hi all,

I have been using this tutorial: bootply.com

and I almost have it working, the problem is that my table is generated VIA AJAX from a php file. Basically I see my table but no working pagination unless I open chrome web tools and go to console and paste the following line:

$('#myTable').pageMe({pagerSelector:'#myPager',showPrevNext:true,hidePageNumbers:false,perPage:4});

My javascript in my document is nested within a $(document).ready(function(){}); and I have the ajax call to generate the table first followed by the call to call the pagination function. Attached at the bottom is my full code VIA pastebin. Is there anyway I can get this function to work with my project or is there a different method of pagination that you would recommend. This is my first time digging into pagination so I am fairly new.

I think the problem is that the function that I show above is being called and doesn't realize there is a table there because in the html there are no rows because it needs to be generated first with ajax. When execution of the page has stopped and the information is there and I run it via console it works as I said. I believe I could make a button that says generate table that when clicked will generate the table by calling that function but I would much rather it be automatic.
Source Code

Member Avatar for diafol

I can't say that this is true pagination of fresh data (bootply example). This is a show-and-hide pagination, where ALL the data is in the page on load ad then the data is chunked and one chunk displayed at a time.

Have a look at my recent tutorial - DaniWeb Tutorial: Common Issues with MySQL and PHP - 6. How to Paginate and Create Page Number Links?

This may give you an idea of how to request fresh data from link click. If you're just after a show-and-hide affair, then disregard.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.