Home >Web Front-end >JS Tutorial >How to use jQuery layui paging control

How to use jQuery layui paging control

小云云
小云云Original
2018-01-13 10:41:561502browse

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=&#39;panel panel-default&#39;>";
norice_content += " <p class=&#39;panel-heading&#39;>";
norice_content += " <h3 class=&#39;panel-title&#39;>";
norice_content += Row.CreateDate;
norice_content += " ";
norice_content += Row.Creater;
norice_content += " </h3>";
norice_content += " </p>";
norice_content += " <p class=&#39;panel-body&#39;>";
norice_content += Row.NoticeContent;
norice_content += " </p>";
norice_content += " </p>";
});
$(&#39;#notice_p&#39;).html(norice_content);
//alert(11);
//调用分页
laypage({
cont: &#39;notice_pages&#39;,//容器。值支持id名、原生dom对象,jquery对象。【如该容器为】:<p id="page1"></p>
pages: datajson.pages,//总页数
groups: 5, //连续显示分页数
skip: false, //是否开启跳页
skin: &#39;#AF0000&#39;,
curr: curr || 1, //当前页,
jump: function (obj, first) {//触发分页后的回调
if (!first) {//点击跳页触发函数自身,并传递当前页:obj.curr
GetNoticeList(obj.curr, cid);
}
}
})
}
});
}
$(document).ready(function () {
GetNoticeList(0, &#39;<%=_courseid%>&#39;)
});
</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!

Statement:
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