views:

49

answers:

1

I have yet to come across a good tutorial that explains how to load records from a database and spit them out using jQuery Ajax and also display pagination navigation.

Example Page

  • Apple
  • Banana
  • Pear
  • Grapes

(Pagination Nav) [First Page] [Prev Page] [5] [6] [7] [Next Page] [Last Page]

In my head I think it works like this.

  1. User loads home page. Home page by default spits out records with at the first offset and with a specified results per page (e.g. LIMIT 0,10)
  2. Serverside script queries count of records, extrapolates number of pages to navigate by using results per page.
  3. Serverside script echoes a navigation panel based on current page.
  4. jQuery listens for click events on navigation panel, uses get to fetch the content and sets html of content container.

I also want the URL of the site to change in case anyone refreshes the page (to obviously display the desired result).

How can this be done?

A: 

You might want to try dataTables, a jQuery plugin that covers exactly what your talking about look for server-side procesing

Gutzofter