57 lines
1.8 KiB
HTML
57 lines
1.8 KiB
HTML
|
<!DOCTYPE>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>BookSystem 搜索</title>
|
||
|
{{Header}}
|
||
|
{{navcss}}
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
{{nav}}
|
||
|
<div>
|
||
|
<p>图书系统搜索</p>
|
||
|
<p>关键词: <input type="text" placeholder="What's the request?" id="search_box_main" /></p>
|
||
|
<table border="1" id="result_table">
|
||
|
<tr>
|
||
|
<th>图书序号</th>
|
||
|
<th>图书名称</th>
|
||
|
<th>图书种类</th>
|
||
|
<th>操作</th>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
var Request=GetRequest();
|
||
|
$("#search_box_main").attr("value",Request["name"]);
|
||
|
console.log("BookSearch: ",Request["name"]);
|
||
|
|
||
|
mustLogin();
|
||
|
|
||
|
/// Do Search
|
||
|
$.post("/cgi-bin/booksys/doSearch",{name:Request["name"]},function(data){
|
||
|
console.log("BookQuery Success");
|
||
|
if(data.success==1) {
|
||
|
console.log("Query 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("Failed to Query");
|
||
|
}
|
||
|
},"json").fail(function(err){
|
||
|
console.log("Failed to query. "+err);
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|