This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
DBHomework/web/booksys/listbook.html
2017-12-08 22:37:18 +08:00

69 lines
2.1 KiB
HTML

<!DOCTYPE>
<html>
<head>
<title>BookSystem 图书浏览</title>
{{Header}}
{{navcss}}
</head>
<body>
{{nav}}
<div>
<table border="1" id="result_table">
<tr>
<th>图书序号</th>
<th>图书名称</th>
<th>图书种类</th>
<th>操作</th>
</tr>
</table>
<button id="b_lastpage">上一页</button>
<button id="b_nextpage">下一页</button>
</div>
<script>
var Request=GetRequest();
$("button").button().hide(0);
mustLogin();
if( Request["id"]==undefined || isNaN(parseInt(Request["id"])) ) {
console.log("ID is undefined. Changed to 1");
Request["id"]=1;
} else {
console.log("ID is ",Request["id"]," Parsed: ",parseInt(Request["id"]));
}
$.post("/cgi-bin/booksys/doListBook",
{
startid:parseInt(Request["id"]),
amount:10
},
function(data){
console.log("BookList Ajax Success");
if(data.success==1) {
console.log("List Success");
$.each(data.result,function(n,val){
$("#result_table").append(
"<tr><td>"+
val.class_id+
"</td><td>"+
val.book_name+
"</td><td>"+
val.book_type+
"</td><td>"+
"<a href='viewbook.html?id="+val.class_id+"'>查看</a>"+
"</td></tr>"
);
});
} else {
console.log("List Failed");
}
},"json").fail(function(err){
console.log("BookList Ajax Failed");
});
</script>
</body>
</html>