jQuery Pagination Question

送分小仙女□ 提交于 2019-12-13 03:56:53

问题


So I have the following jQuery pagination plugin installed.

http://d-scribe.de/webtools/jquery-pagination/lib/jquery_pagination/README

I understand how to create the pagination navigation, but not quite sure how to implement a new server call everytime a new page is clicked.

Below I've mapped out the steps that I currently have built using PHP and MYSQL.

  1. User searches keyword using HTML form.
  2. jQuery post to PHP process.
  3. PHP gathers 10 records (LIMIT 0,10) and returns to jQuery in JSON format.
  4. jQuery spits out the the first 10 results to a DIV.

Using the pagination plugin I was hoping to adjust the offset whenever a new page is clicked. How do I write a callback function that will allow me to do exactly that?


回答1:


Let's say there are 122 rows and you want to display 20 rows per page. So there are 7 pages. The callback function receives 2 parameters, one of which is the new page index. Let's say the new page index is 5, then the LIMIT statement should be LIMIT(5 * 20, 20).



来源:https://stackoverflow.com/questions/3383840/jquery-pagination-question

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!