


How to implement the paging query function of bootstrap modal box with ajax
This time I will show you how to implement ajax to implement the paging query function of the modal box bootstrap. What are the precautions for ajax to implement the paging query function of the bootstrap modal box? The following is the actual combat Let’s take a look at the case.
1. Rendering
##2 , JSfunction getManagerList(dealerId,page2){
macAddress = document.getElementById("activeXDemo").getMac();
$.get("${ctxPath}/common/dealer/manager?"+Math.random(), {
page2: page2,
pageSize2: 9,
dealerId: dealerId,
macAddress:macAddress
},
function(data){
if(data){
var managerList=data.managerList;
var uploadDir=data.uploadDir;
var rs = "";
for (var i=0;i<managerlist.length>";
rs+="<img src="/static/imghwm/default1.png" data-src="https://img.php.cn/upload/article/000/061/021/62d19d0b28f0664b1e34517c5e46109a-1.png?x-oss-process=image/resize,p_40" class="lazy" alt="How to implement the paging query function of bootstrap modal box with ajax" >";
rs=rs+"<p>"+name+"</p></managerlist.length>
- ";
pagination=pagination+"
- 第 "+(page2 + 1); pagination=pagination+" 页/共 "+pageCount2+" 页 "; pagination += "
- « 首页 "; if(page2>0){ pagination += "
- « 上一页 "; } var start=page2-3; var end=page2+3; if(start(pageCount2-1)){ end = pageCount2-1; start=end -7; } for(var j=start;j-1 && j
- "+(j+1)+" "; } } } if(page2
- « 尾页 "; $('#pagination').empty(); $('#pagination').append(pagination); $('#personAddModel').modal('show'); } } ); }
- 首页 " + "
- 上页 "; for(var j=0;j
- "+page+" "; } } paginHtml+="
- 下页 " + "
- 末页 "; $("#inspectionPlan").find(".modal-body").find(".pagination").append(paginHtml); } } }); } function updatePlan(obj){ var planId=obj.name; $.post(""+otherPath+"/fault-studio/getPlanById.action",{"id":planId},function(data){ if(data.result=="success"){ $(".addbutton").click(); var item=data.items; $("#planName").val(item.name); $("#planTitle").val(item.inspectTitle); $("#showTime").val(item.inspectTime); var module_name=item.module_name; var nameArray=module_name.split("&"); var moudleIdArray=item.inspectContent.split("&"); var nameHtml=""; if(nameArray!=null && nameArray.length>0){ for(var i=0;i
3. Modal box<p>
</p><p>
</p><p>
</p><p>
<button><span>×</span><span>Close</span></button>
<span>经营人员</span>
</p>
<p>
</p><p>
</p><p>
</p>
4. controller@RequestMapping(value = "manager", method =RequestMethod.GET)
public @ResponseBody ModelAndView queryManager(Model model
, @RequestParam(defaultValue = "0")int page2
, @RequestParam(defaultValue = "9")int pageSize2
, @RequestParam(required = false, defaultValue = "")String dealerId
, String macAddress){
FastJsonJsonView view = new FastJsonJsonView();
if(macAddService.checkMacAddress(macAddress, "E")==true){
String uploadDir = this.localUploadTools.getPreviewDir() + "/dealerUpload";
PaginationSupport<managepersonfortouchscreenvo> managerVOPS = dealerService.queryManager(dealerId, page2, pageSize2);
view.addStaticAttribute("page2", page2);
view.addStaticAttribute("uploadDir", uploadDir);
view.addStaticAttribute("managerList", managerVOPS.getObject());
view.addStaticAttribute("stor_no2", managerVOPS.getTotalCount());
view.addStaticAttribute("pageCount2", managerVOPS.getPageCount());
}
return new ModelAndView(view);
}</managepersonfortouchscreenvo>
Okay,
The following introduces you to the bootstrap modal box ajax paging example code. First, I will show you the renderings:Rendering:
Here’s the practical information:
/** * ajax分页 */ $(function(){ $(".modal-body").find(".pagination").on("click","li",function(){ var totalPage=$(".modal-body").find(".pagination").find(".lilength").length; var pageNo=$(this).find("a").text(); var beforePage=""; //获取之前选中的值 $(".modal-body").find(".pagination").find("li").each(function(){ if($(this).hasClass("active")){ beforePage=$(this).find("a").text(); } }); //alert(beforePage); if($(this).find("a").text()=="首页"){ removeClass(); $(".modal-body").find(".pagination").find("li").each(function(){ if($(this).find("a").text()=="1"){ $(this).addClass("active"); } getPlanFy("1"); }); }else if($(this).find("a").text()=="上页"){ if(beforePage==1){ showMessage("已经是第一页了!") }else{ var dqy=parseInt(beforePage)-1; $(".modal-body").find(".pagination").find("li").each(function(){ if($(this).find("a").text()==dqy.toString()){ $(this).addClass("active"); }else{ $(this).removeClass("active"); } }); getPlanFy(dqy); } }else if($(this).find("a").text()=="下页"){ if(beforePage==totalPage){ showMessage("已经是最后一页了!") }else{ var dqy=parseInt(beforePage)+1; $(".modal-body").find(".pagination").find("li").each(function(){ if($(this).find("a").text()==dqy.toString()){ $(this).addClass("active"); }else{ $(this).removeClass("active"); } }); getPlanFy(dqy); } }else if($(this).find("a").text()=="末页"){ removeClass(); $(".modal-body").find(".pagination").find("li").each(function(){ if($(this).find("a").text()==totalPage){ $(this).addClass("active"); } }); getPlanFy(totalPage); }else{ removeClass(); $(this).addClass("active"); getPlanFy(pageNo); } }); // $(".table").find("tbody").on("click",".showMsgDetail",function(){ // var msg=$(this).find("a").attr("name"); // showMagDetail(msg); // }); $(".addbutton").click(function(){ $("#savePlanmodal").removeAttr("name"); $("#planIdsUpdate").val(""); }); }); /** * 弹窗 */ function showMessage(content){ $.alert({ title: '提示', content: content,//支持html icon: 'fa fa-rocket', animation: 'zoom', closeAnimation: 'zoom', buttons: { okay: { text: '确定', btnClass: 'btn-primary' } } }); } /** * 移除css */ function removeClass(){ $(".modal-body").find(".pagination").find("li").each(function(){ $(this).removeClass("active"); }); } function getPlanFy(pageNo){ var pageSize=10; $.post(""+otherPath+"/fault-studio/getInpectPlanList.action", {"pageNo":pageNo,"pageSize":pageSize},function(data){ $("#inspectionPlan").find(".modal-body").find("table").find("tbody").html(""); $("#inspectionPlan").find(".modal-body").find(".pagination").html(""); var appendHtml=""; if(data.items!=null && data.items.length>0){ $.each(data.items,function(i,item){ var number=parseInt(i)+1; appendHtml+="<tr>" + "<td>"+number+"</td>" + "<td><a>"+item[1]+"</a></td>" + "<td>"+item[2]+"</td>"+ "<td>"+item[3]+"</td>"+ "<td> <a>修改</a> <a>删除</a> </td>" "</tr>" }); $("#inspectionPlan").find(".modal-body").find("table").find("tbody").append(appendHtml); var paginHtml=""; if(isNotTirmpagin(data.totalPage) && data.totalPage>0){ paginHtml+="
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to php Chinese Other related articles online!
Recommended reading:
Ajax drop-down list adding dataHow to solve the problem of cookie loss during Ajax cross-domain accessThe above is the detailed content of How to implement the paging query function of bootstrap modal box with ajax. For more information, please follow other related articles on the PHP Chinese website!

Whether to choose Python or JavaScript depends on the project type: 1) Choose Python for data science and automation tasks; 2) Choose JavaScript for front-end and full-stack development. Python is favored for its powerful library in data processing and automation, while JavaScript is indispensable for its advantages in web interaction and full-stack development.

Python and JavaScript each have their own advantages, and the choice depends on project needs and personal preferences. 1. Python is easy to learn, with concise syntax, suitable for data science and back-end development, but has a slow execution speed. 2. JavaScript is everywhere in front-end development and has strong asynchronous programming capabilities. Node.js makes it suitable for full-stack development, but the syntax may be complex and error-prone.

JavaScriptisnotbuiltonCorC ;it'saninterpretedlanguagethatrunsonenginesoftenwritteninC .1)JavaScriptwasdesignedasalightweight,interpretedlanguageforwebbrowsers.2)EnginesevolvedfromsimpleinterpreterstoJITcompilers,typicallyinC ,improvingperformance.

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe


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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
