jquery layuiPaging The control is often used in the project development stage. Let’s introduce the use of jQuery layui paging control through this article. It is very good. Friends who are interested in layui will come together. Let’s take a look
$.getJSON()Introduction to the usage
$.getJSON( url [, data ] [, success(data, textStatus, jqXHR) ] )
url is a required parameter, indicating the address of the json data;
data is an optional parameter, use Send data parameters when requesting data;
success is parameterizable. This is a callback function used to process the requested data.
//内容页面 <br> <p id="notice_p"></p><br> //分页控件 <p id="notice_pages"></p> <script> var roolurl = "http://" + window.location.host; var urlAshx = roolurl + "/aa/Ashx/NoticeInfo.ashx"; //var pages = 0; //获取分页好的公告内容 function GetNoticeList(curr, cid) { $.getJSON(urlAshx, {//参数 action: "notice_action", courseid: cid, page: curr || 1,//向服务端传的参数,此处只是演示 nums: 3//每页显示的条数 }, function (datajson) {//成功执行的方法 if (datajson != null) { var norice_content = ""; //alert(datajson.pages); $(datajson.rows).each(function (n, Row) { norice_content += " <p class='panel panel-default'>"; norice_content += " <p class='panel-heading'>"; norice_content += " <h3 class='panel-title'>"; norice_content += Row.CreateDate; norice_content += " "; norice_content += Row.Creater; norice_content += " </h3>"; norice_content += " </p>"; norice_content += " <p class='panel-body'>"; norice_content += Row.NoticeContent; norice_content += " </p>"; norice_content += " </p>"; }); $('#notice_p').html(norice_content); //alert(11); //调用分页 laypage({ cont: 'notice_pages',//容器。值支持id名、原生dom对象,jquery对象。【如该容器为】:<p id="page1"></p> pages: datajson.pages,//总页数 groups: 5, //连续显示分页数 skip: false, //是否开启跳页 skin: '#AF0000', curr: curr || 1, //当前页, jump: function (obj, first) {//触发分页后的回调 if (!first) {//点击跳页触发函数自身,并传递当前页:obj.curr GetNoticeList(obj.curr, cid); } } }) } }); } $(document).ready(function () { GetNoticeList(0, '<%=_courseid%>') }); </script>
The above is the use of jQuery layui paging control introduced by the editor. I hope it will be helpful to everyone! !
Related recommendations:
Detailed explanation of how layui.js implements form verification function
layui form implementation code sharing
layui tab effect implementation code sharing
The above is the detailed content of In-depth understanding of the use of jQuery layui paging control. For more information, please follow other related articles on the PHP Chinese website!