jQuery分页问题 [英] jQuery Pagination Question

查看:113
本文介绍了jQuery分页问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我安装了以下jQuery分页插件.

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.

下面,我列出了当前使用PHP和MYSQL构建的步骤.

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

  1. 用户使用HTML表单搜索关键字.
  2. jQuery发布到PHP进程.
  3. PHP收集10条记录(LIMIT 0,10),并以JSON格式返回jQuery.
  4. jQuery将前10个结果吐出到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?

推荐答案

假设有122行,并且您希望每页显示20行.因此共有7页.回调函数接收2个参数,其中之一是新页面索引.假设新页面索引为5,那么LIMIT语句应为LIMIT(5 * 20,20).

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).

这篇关于jQuery分页问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆