


Detailed explanation of the simple implementation of AJAX paging effect
Recently I wrote a function to add roles to a user group. It requires unadded roles on one side and added roles on the other, as well as a search function. After clicking add, the ajax save operation is performed. This article mainly introduces AJAX in detail to everyone. The simple implementation code of the paging effect has certain reference value. Interested friends can refer to it. I hope it can help everyone.
Consider the function to be paging for the query function. The paging bar below has a total of 2*2 and 4 ajax...
$(document).ready(function() { App.init(); currentRole(); // 当前角色 currentRolePage();//当前角色分页 noAddRole(); //未添加角色 noAddRolePage();//未添加角色分页 }); //当前角色列表 function currentRole(){ var currentRoleCheckName =$("#currentRoleCheckName").val(); // 当前角色的list集合 $.ajax({ async:true, type:"POST", //date:"groupId=rose",//发送到服务器的数据 url:"${ctx}/group/ajax_showRolesForGroup.do",//请求路径 data:{"groupId":groupId, "page":page1, "checkName":currentRoleCheckName }, dataType:"json", //返回数据的类型 success:function(data){ //成功响应后的回调函数 var result =data.pageSupport.items; console.log(data.pageSupport) var s=""; for(var i in result){ s+="<tr class='odd gradeX'><td>"+result[i].name+"</td>" +"<td>"+result[i].remark+"</td>" +"<td><button type='button' class='btn btn-xs btn-info m-r-5' onclick='to_RemoveRoleToGroup("+result[i].roleId+");'>移除</button></td></tr>"; } $("#currentRole").html(s); } }); } //当前角色的分页 function currentRolePage(){ var currentRoleCheckName =$("#currentRoleCheckName").val(); var totalPage=0; $.ajax({ async:true, type:"POST", //date:"groupId=rose",//发送到服务器的数据 url:"${ctx}/group/ajax_showRolesForGroup.do",//请求路径 data:{"groupId":groupId, "page":page1, "checkName":currentRoleCheckName }, dataType:"json", //返回数据的类型 success:function(data){ //成功响应后的回调函数 totalPage=data.pageSupport.last; console.log(totalPage) var i= 0; var a=""; for( i=page1-2; i<=page1+2;i++){ if(i>0 && i<=totalPage){ if(i == 1){ $("#prev1").attr('class','disabled'); } if(page1 == i){ a+="<li class='active' bs1='" + i + "'><a>"+i+"</a></li>"; }else{ a+="<li class='zhong1' bs1='" + i + "'><a href='javascript:void(0);' onclick='a_method("+i+");' >"+i+"</a></li>"; } } } $("#fy_list").html(a); } }); } //中间页 function a_method(i) { page1 = i; currentRole(); // 当前角色 currentRolePage();//当前角色分页 } //查询操作 function currentRoleCheck(){ page1=1; currentRole(); // 当前角色 currentRolePage();//当前角色分页 }
<!-- 两个相同的p 下面只是一个--> <p class="panel-body col-md-6"> <p style="border: 1px solid #E0E0E0;border-radius: 4px"> <p class="panel-heading " style="background-color:#E0E0E0; "> <h2 class="panel-title"><b>已选角色</b></h2> </p> <p id="firstCheck" class="panel-body"> <p style="padding-left: 0 !important;" id="firstCheck" class="panel-body"> <form class="form-inline" method="POST" > <p class="form-group m-r-10"> <input id="currentRoleCheckName" type="text" class="form-control" placeholder="角色名称" name="fname" maxlength="40" /> </p> <p class="checkbox m-r-10"> </p> <button id="currentCheck"type="button" class="btn btn-sm btn-primary m-r-5" onclick="currentRoleCheck()" >查询</button> </form> </p> <p > <table id='data-table' class='table table-bordered' > <thead> <tr> <th>角色名称</th> <th>备注信息</th> <th>操作</th> </tr> </thead> <tbody id="currentRole"> <!-- 当前用户组已有角色list --> </tbody> </table> </p> <p class="buttonBox"> <p align="right"> <ul id="fy_list" class="pagination pagination-sm m-t-0 m-b-10 "> </ul> </p> </p> </p> </p> </p>
How to implement ajax paging in PHP Summary
php Ajax paging simple application example_PHP tutorial
The above is the detailed content of Detailed explanation of the simple implementation of AJAX paging effect. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

You may have encountered the problem of green lines appearing on the screen of your smartphone. Even if you have never seen it, you must have seen related pictures on the Internet. So, have you ever encountered a situation where the smart watch screen turns white? On April 2, CNMO learned from foreign media that a Reddit user shared a picture on the social platform, showing the screen of the Samsung Watch series smart watches turning white. The user wrote: "I was charging when I left, and when I came back, it was like this. I tried to restart, but the screen was still like this during the restart process." Samsung Watch smart watch screen turned white. The Reddit user did not specify the smart watch. Specific model. However, judging from the picture, it should be Samsung Watch5. Previously, another Reddit user also reported

The hard disk serial number is an important identifier of the hard disk and is usually used to uniquely identify the hard disk and identify the hardware. In some cases, we may need to query the hard drive serial number, such as when installing an operating system, finding the correct device driver, or performing hard drive repairs. This article will introduce some simple methods to help you check the hard drive serial number. Method 1: Use Windows Command Prompt to open the command prompt. In Windows system, press Win+R keys, enter "cmd" and press Enter key to open the command

Speaking of ASSASSIN, I believe players will definitely think of the master assassins in "Assassin's Creed". They are not only skilled, but also have the creed of "devoting themselves to the darkness and serving the light". The ASSASSIN series of flagship air-cooled radiators from the appliance brand DeepCool coincide with each other. Recently, the latest product of this series, ASSASSIN4S, has been launched. "Assassin in Suit, Advanced" brings a new air-cooling experience to advanced players. The appearance is full of details. The Assassin 4S radiator adopts a double tower structure + a single fan built-in design. The outside is covered with a cube-shaped fairing, which has a strong overall sense. It is available in white and black colors to meet different colors. Tie

Title: Methods and code examples to resolve 403 errors in jQuery AJAX requests. The 403 error refers to a request that the server prohibits access to a resource. This error usually occurs because the request lacks permissions or is rejected by the server. When making jQueryAJAX requests, you sometimes encounter this situation. This article will introduce how to solve this problem and provide code examples. Solution: Check permissions: First ensure that the requested URL address is correct and verify that you have sufficient permissions to access the resource.

With the arrival of spring, everything revives and everything is full of vitality and vitality. In this beautiful season, how to add a touch of color to your home life? Haqu H2 projector, with its exquisite design and super cost-effectiveness, has become an indispensable beauty in this spring. This H2 projector is compact yet stylish. Whether placed on the TV cabinet in the living room or next to the bedside table in the bedroom, it can become a beautiful landscape. Its body is made of milky white matte texture. This design not only makes the projector look more advanced, but also increases the comfort of the touch. The beige leather-like material adds a touch of warmth and elegance to the overall appearance. This combination of colors and materials not only conforms to the aesthetic trend of modern homes, but also can be integrated into

A large model that can automatically analyze the content of PDFs, web pages, posters, and Excel charts is not too convenient for workers. The InternLM-XComposer2-4KHD (abbreviated as IXC2-4KHD) model proposed by Shanghai AILab, the Chinese University of Hong Kong and other research institutions makes this a reality. Compared with other multi-modal large models that have a resolution limit of no more than 1500x1500, this work increases the maximum input image of multi-modal large models to more than 4K (3840x1600) resolution, and supports any aspect ratio and 336 pixels to 4K Dynamic resolution changes. Three days after its release, the model topped the HuggingFace visual question answering model popularity list. Easy to handle

With its compact size, the ITX platform has attracted many players who pursue the ultimate and unique beauty. With the improvement of manufacturing processes and technological advancements, both Intel's 14th generation Core and RTX40 series graphics cards can exert their strength on the ITX platform, and gamers also There are higher requirements for SFX power supply. Game enthusiast Huntkey has launched a new MX series power supply. In the ITX platform that meets high-performance requirements, the MX750P full-module power supply has a rated power of up to 750W and has passed 80PLUS platinum level certification. Below we bring the evaluation of this power supply. Huntkey MX750P full-module power supply adopts a simple and fashionable design concept. There are two black and white models for players to choose from. Both use matte surface treatment and have a good texture with silver gray and red fonts.

jQuery is a popular JavaScript library used to simplify client-side development. AJAX is a technology that sends asynchronous requests and interacts with the server without reloading the entire web page. However, when using jQuery to make AJAX requests, you sometimes encounter 403 errors. 403 errors are usually server-denied access errors, possibly due to security policy or permission issues. In this article, we will discuss how to resolve jQueryAJAX request encountering 403 error
