深入理解jQuery layui分頁控件的使用
$.getJSON( )的使用方法簡介
$.getJSON( url [, data ] [, success(data, textStatus, jqXHR) ] )
url是必選參數(shù),表示json數(shù)據(jù)的地址;
data是可選參數(shù),用于請求數(shù)據(jù)時(shí)發(fā)送數(shù)據(jù)參數(shù);
success是可參數(shù),這是一個(gè)回調(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對象。【如該容器為】:<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) {//點(diǎn)擊跳頁觸發(fā)函數(shù)自身,并傳遞當(dāng)前頁:obj.curr
GetNoticeList(obj.curr, cid);
}
}
})
}
});
}
$(document).ready(function () {
GetNoticeList(0, '<%=_courseid%>')
});
</script>
以上所述是小編給大家介紹的jQuery layui分頁控件的使用,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- layUI實(shí)現(xiàn)前端分頁和后端分頁
- layui實(shí)現(xiàn)數(shù)據(jù)分頁功能(ajax異步)
- layui實(shí)現(xiàn)數(shù)據(jù)表格table分頁功能(ajax異步)
- layui實(shí)現(xiàn)數(shù)據(jù)分頁功能
- Layui實(shí)現(xiàn)帶查詢條件的分頁
- layui實(shí)現(xiàn)動(dòng)態(tài)和靜態(tài)分頁
- 基于LayUI分頁和LayUI laypage分頁的使用示例
- 基于LayUI實(shí)現(xiàn)前端分頁功能的方法
- layui分頁效果實(shí)現(xiàn)代碼
- 基于ssm框架實(shí)現(xiàn)layui分頁效果
相關(guān)文章
使用jquery+CSS3實(shí)現(xiàn)仿windows10開始菜單的下拉導(dǎo)航菜單特效
本文是基于jquery和css3實(shí)現(xiàn)的仿windows10開始菜單的下拉導(dǎo)航菜單特效,代碼超簡單,感興趣的朋友一起看看吧2015-09-09
ThinkPHP+jquery實(shí)現(xiàn)“加載更多”功能代碼
本篇文章主要介紹了ThinkPHP+jquery實(shí)現(xiàn)“加載更多”功能代碼,以實(shí)例代碼講訴了加載更多的代碼實(shí)現(xiàn),非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-03-03
利用imgareaselect輔助后臺(tái)實(shí)現(xiàn)圖片上傳裁剪
這篇文章主要為大家詳細(xì)介紹了利用imgareaselect輔助后臺(tái)實(shí)現(xiàn)圖片裁剪的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-03-03
利用JQuery制作符合Web標(biāo)準(zhǔn)的QQ彈出消息
本篇文章主要介紹了利用JQuery制作符合Web標(biāo)準(zhǔn)的QQ彈出消息。這里所說的彈出消息指的是在網(wǎng)頁右下角升起又下去的那種框框,在這里用到了jQuery的自定義動(dòng)畫2014-01-01
Jquery實(shí)現(xiàn)點(diǎn)擊按鈕,連續(xù)地向textarea中添加值的實(shí)例代碼
本篇文章主要是對Jquery實(shí)現(xiàn)點(diǎn)擊按鈕,連續(xù)地向textarea中添加值的實(shí)例代碼進(jìn)行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-03-03
鋒利的jQuery 要點(diǎn)歸納(二) jQuery中的DOM操作(下)
鋒利的jQuery 要點(diǎn)歸納(二) jQuery中的DOM操作(下)2010-03-03

