Home>Article>Backend Development> Detailed example of kkpager implementing ajax paging query function
This article mainly introduces kkpager to realize the ajax paging query function and paginate data in the foreground. It is suitable when there is a small amount of data. Because the paging data is obtained from the background, it is not recommended for big data. , please refer to this article for the specific front and backend code, I hope it can help you.
Foreground paging data is suitable when there is a small amount of data, because the paging data is obtained from the background. It is not recommended for large data.
Let’s take a look at the front-end code first:
@{ Layout = null; }Index
The back-end code:
##
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web; using System.Web.Mvc; namespace MvcKKpager.Controllers { public class HomeController : Controller { private readonly int pageSize = 2; // // GET: /Home/ public ActionResult Index() { return View(); } public ActionResult Index2(string pageIndex) { ListThere’s nothing much to say Look at the stylelist = new List (); list.Add("保护环境"); list.Add("保护环境"); list.Add("保护环境"); list.Add("保护环境"); list.Add("保护环境"); var persons = (from p in list select p).Skip((int.Parse(pageIndex) - 1) * pageSize).Take(pageSize); StringBuilder builder = new StringBuilder(); builder.Append(" "); builder.Append("
"); var result = new { status = "1", data = builder.ToString(), pagecount = list.Count().ToString(), pagesize = pageSize.ToString() }; return Json(result); } } }"); builder.Append(""); foreach (var item in persons) { builder.Append(" 时间 展示 点击(点击率) 激活(激活率) 平均点击单价 实际激活成本 消耗 "); builder.Append(" "); } builder.Append("" + item + " "); builder.Append("" + item + " "); builder.Append("" + item+" "); builder.Append("" + item + " "); builder.Append("" + item + " "); builder.Append("" + item + " "); builder.Append("" + item + " "); builder.Append("
Summary of how PHP implements ajax paging
Detailed explanation of the simple implementation of AJAX paging effect
php Ajax paging simple application example_PHP tutorial
The above is the detailed content of Detailed example of kkpager implementing ajax paging query function. For more information, please follow other related articles on the PHP Chinese website!