views:

312

answers:

2

I am trying to implement paging in PHP, using Json. I need the data to be preloaded, before the user click next results. Please Give me some suggestions or some references.

A: 

jquery has a plugin you can use for pagination, the results have to be preloaded for this as far as i know. We are using this in an app currently, but it wasn't implemented by me...

http://plugins.jquery.com/project/pagination

Nicky De Maeyer
+2  A: 

First off, JSON is for data communication not for data presentation. You need to store the JSON data in a persistent place, either a session variable or in Javascript variables. If you use the PHP session you'd use the PHP code to step through the data, if Javascript I'd go with JQuery. Just store the current starting point in the data in a persistent variable as well and use that as the place to start reading the data each time you display a new page.

hofo
If you do a Google search for "json php paging" you'll find several tutorials on how to accomplish this: http://www.google.com/search?q=json+php+paging
hofo
JSON is "for" data representation, not communication (I guess you might have meant "communication" differently, though).
Matt Ball