欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

深入理解jQuery layui分頁控件的使用

 更新時間:2016年08月17日 15:11:26   作者:分頁控件  
jquery layui分頁控件在項目開發(fā)階段經(jīng)常用到,下面通過本文給大家介紹jQuery layui分頁控件的使用,非常不錯,感興趣的朋友一起看下吧

$.getJSON( )的使用方法簡介

$.getJSON( url [, data ] [, success(data, textStatus, jqXHR) ] )

url是必選參數(shù),表示json數(shù)據(jù)的地址;

data是可選參數(shù),用于請求數(shù)據(jù)時發(fā)送數(shù)據(jù)參數(shù);

success是可參數(shù),這是一個回調(diào)函數(shù),用于處理請求到的數(shù)據(jù)。

//內(nèi)容頁面 <br>   
<div id="notice_div"></div><br>   //分頁控件
<div id="notice_pages"></div>
<script>
var roolurl = "http://" + window.location.host;
var urlAshx = roolurl + "/aa/Ashx/NoticeInfo.ashx";
//var pages = 0;
//獲取分頁好的公告內(nèi)容
function GetNoticeList(curr, cid) {
$.getJSON(urlAshx,
{//參數(shù)
action: "notice_action",
courseid: cid,
page: curr || 1,//向服務(wù)端傳的參數(shù),此處只是演示
nums: 3//每頁顯示的條數(shù)
}, function (datajson) {//成功執(zhí)行的方法
if (datajson != null) {
var norice_content = "";
//alert(datajson.pages);
$(datajson.rows).each(function (n, Row) {
norice_content += " <div class='panel panel-default'>";
norice_content += " <div class='panel-heading'>";
norice_content += " <h3 class='panel-title'>";
norice_content += Row.CreateDate;
norice_content += " ";
norice_content += Row.Creater;
norice_content += " </h3>";
norice_content += " </div>";
norice_content += " <div class='panel-body'>";
norice_content += Row.NoticeContent;
norice_content += " </div>";
norice_content += " </div>";
});
$('#notice_div').html(norice_content);
//alert(11);
//調(diào)用分頁
laypage({
cont: 'notice_pages',//容器。值支持id名、原生dom對象,jquery對象?!救缭撊萜鳛椤浚?lt;div id="page1"></div>
pages: datajson.pages,//總頁數(shù)
groups: 5, //連續(xù)顯示分頁數(shù)
skip: false, //是否開啟跳頁
skin: '#AF0000',
curr: curr || 1, //當(dāng)前頁,
jump: function (obj, first) {//觸發(fā)分頁后的回調(diào)
if (!first) {//點擊跳頁觸發(fā)函數(shù)自身,并傳遞當(dāng)前頁:obj.curr
GetNoticeList(obj.curr, cid);
}
}
})
}
});
}
$(document).ready(function () {
GetNoticeList(0, '<%=_courseid%>')
});
</script> 

以上所述是小編給大家介紹的jQuery layui分頁控件的使用,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論