You can do paging in various ways, simple or fancy. simple would be a php script that takes a few parameters (what the comments relate to, which index of comments to start display at, how many items to display, etc) and returns a html snippet containing the comment items. the next/previous buttons would trigger a javascript function that calls the php script, then inserts the returned html into the correct place in the dom. pagination itself can be coordinated in js or php, whichever you prefer. if i do it in php, then i'd insert some <input type="hidden" id="comment_[comment_id]_paramname" value="something"> into the returned html, so that js can read it out and use it whenever the next/prev button is clicked again. and ofcourse you'd disable the next/prev buttons during the ajax call to the script, to prevent mishaps and click-ddos-ing.
fancy would be anything that - loads up pages before they are actually clicked to. i'd pre-fetch only 1 or 2 pages before and after the page the user is currently viewing, again to save work on the server. my selfbuilt slideshow/lightbox for my cms prefetches meta-data and images for the next / previous image being viewed (slideshow runs in 1 direction at-a-time). it works quite nicely, as data is fetched while the user watches the current image. - has a js cache variable (array of arrays containing parameters and the returned html) in which you store any page viewed. if the user browses back, he'd get the cached page. note: doesnt work if the data viewed gets (often) edited after posting. - smooth-scrolls from page to page. this is where jquery can help easilly and quickly. if you describe the scrolleffect you want, we can recommend some ways of achieving that. martatw wrote: > Hi, > > I have a list of comments that is filled using json and jquery. The > problem is that there are 40 comments displied on one page. How can I > do paging? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
