<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="js/layui/css/layui.css">
<link rel="stylesheet" href="js/bootstrap-table.min.css"></link>
<link rel="stylesheet" href="js/bootstrap.min.css"></link>
</head>
<body>
<table class="table table-striped">
<thead>
<th>優惠券類型</th>
<th>發放對象</th>
<th>發放時間</th>
<th>發放面額</th>
<th>每用戶發放數量</th>
<th>有效期</th>
</thead>
<tbody id="tbs">
</tbody>
</table>
<div id="demo8"></div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-table.min.js"></script>
<script src="js/layui/layui.js"></script>
<script>
$(function(){
fenye();
})
function fenye(){
layui.use(['laypage', 'layer'], function(){
var laypage = layui.laypage
,layer = layui.layer;
//自定義排版
$.ajax({
type:'post',
dataType:'json',
data:{'curr':1,'limit':10},
url:'../../DataShow3',
success:function(data){
showData(data);
laypage.render({
elem: 'demo8'
,count: data.ct
,layout: ['limit', 'prev', 'page', 'next']
,jump:function(obj){
//分頁切換的回掉
$.ajax({
type:'post',
dataType:'json',
data:{'curr':obj.curr,'limit':obj.limit},
url:'../../DataShow3',
success:function(data){
showData(data);
}
})
}
});
}
})
});
}
function showData(ds){
$("#tbs").empty();
var htmlStr="";
for(var i=0;i<ds.data.length;i++){
htmlStr+='<tr><td>';
htmlStr+=ds.data[i].id;
htmlStr+='</td><td>';
htmlStr+=ds.data[i].className;
htmlStr+='</td><td>';
htmlStr+=ds.data[i].classSumNum;
htmlStr+='</td><td>';
htmlStr+=ds.data[i].teacherName;
htmlStr+='</td><td>';
htmlStr+=ds.data[i].fdyName;
htmlStr+='</td><td>';
htmlStr+=ds.data[i].fdyNum;
htmlStr+='</td></tr>'
}
$("#tbs").append(htmlStr);
}
</script>
</body>
</html>
layui 分頁
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.