jquery layui paging control is often used in the project development stage. This article will introduce to you the use of jQuery layui paging control. It is very good. Friends who are interested should take a look at it. I hope it can help everyone. Introduction to the usage of
$.getJSON()
$.getJSON( url [, data ] [, success(data, textStatus, jqXHR) ] )
url is a required parameter, indicating the address of json data;
data is an optional parameter, used to send data parameters when requesting data;
success is an optional parameter, which 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>
Related recommendations:
layui paging effect implementation code sharing
LayUI Detailed explanation of the difference between paging and LayUI laypage paging
LayUI implements front-end paging function
The above is the detailed content of How to use jQuery layui paging control. For more information, please follow other related articles on the PHP Chinese website!