国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Web Front-end JS Tutorial How to implement AJAX paging effect

How to implement AJAX paging effect

Mar 31, 2018 pm 03:02 PM
ajax Pagination Effect

This time I will show you how to achieve the paging effect of AJAX and what are the precautions to achieve the paging effect of AJAX. The following is a practical case, let's take a look.

I recently wrote a function to add roles to user groups. It requires unadded roles on one side and added roles on the other, as well as a search function. After clicking add, ajax saves the operation.

Consider the function to be paging for the query function. The paging bar below has a total of 2*2 and 4 ajax...

The JS code is as follows:

$(document).ready(function()?{
??App.init();
??currentRole();?//?當(dāng)前角色
??currentRolePage();//當(dāng)前角色分頁
??noAddRole();?//未添加角色
??noAddRolePage();//未添加角色分頁
?});
//當(dāng)前角色列表
function?currentRole(){
??var?currentRoleCheckName?=$("#currentRoleCheckName").val();
??//?當(dāng)前角色的list集合
??$.ajax({
??async:true,?
??type:"POST",?
??//date:"groupId=rose",//發(fā)送到服務(wù)器的數(shù)據(jù)
??url:"${ctx}/group/ajax_showRolesForGroup.do",//請求路徑
??data:{"groupId":groupId,?
??"page":page1,
??"checkName":currentRoleCheckName
??},
??dataType:"json",?//返回數(shù)據(jù)的類型
??success:function(data){?//成功響應(yīng)后的回調(diào)函數(shù)
??var?result?=data.pageSupport.items;
??console.log(data.pageSupport)
??var?s="";
??for(var?i?in?result){?
???s+="<tr class=&#39;odd gradeX&#39;><td>"+result[i].name+"</td>"
???+"<td>"+result[i].remark+"</td>"
???+"<td><button type=&#39;button&#39; class=&#39;btn btn-xs btn-info m-r-5&#39; onclick=&#39;to_RemoveRoleToGroup("+result[i].roleId+");&#39;>移除</button></td></tr>";
??}
??$("#currentRole").html(s);
??}
?});
?}
//當(dāng)前角色的分頁
?function?currentRolePage(){
??var?currentRoleCheckName?=$("#currentRoleCheckName").val();
??var?totalPage=0;
??$.ajax({
??async:true,?
??type:"POST",?
??//date:"groupId=rose",//發(fā)送到服務(wù)器的數(shù)據(jù)
??url:"${ctx}/group/ajax_showRolesForGroup.do",//請求路徑
??data:{"groupId":groupId,?
??"page":page1,
??"checkName":currentRoleCheckName
??},
??dataType:"json",?//返回數(shù)據(jù)的類型
??success:function(data){?//成功響應(yīng)后的回調(diào)函數(shù)
??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(&#39;class&#39;,&#39;disabled&#39;); 
   }
   if(page1 == i){
   a+="<li class=&#39;active&#39; bs1=&#39;" + i + "&#39;><a>"+i+"</a></li>";
???}else{
???a+="<li class=&#39;zhong1&#39; bs1=&#39;" + i + "&#39;><a href=&#39;javascript:void(0);&#39; onclick=&#39;a_method("+i+");&#39; >"+i+"</a></li>";
???}
??}
??}
??$("#fy_list").html(a);
??}
?});
?}
?//中間頁?
?function?a_method(i)?{
??page1?=?i;
??currentRole();?//?當(dāng)前角色
??currentRolePage();//當(dāng)前角色分頁
?}
//查詢操作
function?currentRoleCheck(){
?page1=1;
?currentRole();?//?當(dāng)前角色
?currentRolePage();//當(dāng)前角色分頁
?}
HTML The code is as follows:

<!-- 兩個相同的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=&#39;data-table&#39; class=&#39;table table-bordered&#39; >
???<thead>
?????<tr>
?????<th>角色名稱</th>
?????<th>備注信息</th>
?????<th>操作</th>
?????</tr>?
???</thead>
???<tbody id="currentRole">
????<!--
    當(dāng)前用戶組已有角色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>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

Using AJAX to implement paging function

Ajax to implement infinite loading of lists and secondary drop-down menu options (With code)

The above is the detailed content of How to implement AJAX paging effect. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276
Users encounter rare glitches: Samsung Watch smartwatches suddenly experience white screen issues Users encounter rare glitches: Samsung Watch smartwatches suddenly experience white screen issues Apr 03, 2024 am 08:13 AM

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

PHP and Ajax: Building an autocomplete suggestion engine PHP and Ajax: Building an autocomplete suggestion engine Jun 02, 2024 pm 08:39 PM

Build an autocomplete suggestion engine using PHP and Ajax: Server-side script: handles Ajax requests and returns suggestions (autocomplete.php). Client script: Send Ajax request and display suggestions (autocomplete.js). Practical case: Include script in HTML page and specify search-input element identifier.

Kyushu Fengshen Assassin 4S Radiator Review Air-cooled 'Assassin Master' Style Kyushu Fengshen Assassin 4S Radiator Review Air-cooled 'Assassin Master' Style Mar 28, 2024 am 11:11 AM

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

Huntkey MX750P full module power supply review: 750W of concentrated platinum strength Huntkey MX750P full module power supply review: 750W of concentrated platinum strength Mar 28, 2024 pm 03:20 PM

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.

Easily understand 4K HD images! This large multi-modal model automatically analyzes the content of web posters, making it very convenient for workers. Easily understand 4K HD images! This large multi-modal model automatically analyzes the content of web posters, making it very convenient for workers. Apr 23, 2024 am 08:04 AM

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

Exquisite light and shadow art in spring, Haqu H2 is the cost-effective choice Exquisite light and shadow art in spring, Haqu H2 is the cost-effective choice Apr 17, 2024 pm 05:07 PM

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

Colorful Hidden Star P15 24 Review: A hard-core all-round gaming laptop with both good looks and performance Colorful Hidden Star P15 24 Review: A hard-core all-round gaming laptop with both good looks and performance Mar 06, 2024 pm 04:40 PM

In the current era of rapid technological development, laptops have become an indispensable and important tool in people's daily life and work. For those players who have high performance requirements, a laptop with powerful configuration and excellent performance can meet their hard-core needs. With its excellent performance and stunning design, the Colorful Hidden Star P15 notebook computer has become the leader of the future and can be called a model of hard-core notebooks. Colorful Hidden Star P1524 is equipped with a 13th generation Intel Core i7 processor and RTX4060Laptop GPU. It adopts a more fashionable spaceship design style and has excellent performance in details. Let us first take a look at the features of this notebook. Supreme equipped with Intel Core i7-13620H processing

A true one-lens experience with the NIKKOR Z 28-400mm f/4-8 VR lens A true one-lens experience with the NIKKOR Z 28-400mm f/4-8 VR lens Mar 28, 2024 pm 02:54 PM

Many photography enthusiasts like to use lenses. Their shooting needs are very changeable, so when it comes to lens selection, they prefer a more versatile product, which is what we commonly call "one lens to conquer the world" lens. It just so happens that Nikon has launched a new product, the NIKKOR Z28-400mmf/4-8VR lens, a true "one lens that can conquer the world" lens. The lens covers from the 28mm wide-angle end to the 400mm telephoto end. Equipped with its Z-mount camera, it can easily shoot a very rich range of photography themes and bring about a rich change of perspective. Today, we will talk to you about this NIKKOR Z28-400mmf/4-8VR lens through our recent use experience. NIKKOR Z28-400mmf/4-8VR is

See all articles