-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
81 lines (74 loc) · 2.84 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<title>臺東大學資工系系圖藏書</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/jquery.sieve.min.js"></script>
<script>
function booksLoop(JData){
var str = "";
for (var i = 0; i < JData.length ; i++){
//console.log(data[i]["book_name"]);
str += "<tr>";
str += "<td>"+JData[i]["book_name"]+"</td>";
str += "<td>"+JData[i]["book_writer"]+"</td>";
str += "<td>"+JData[i]["book_press"]+"</td>";
str += "<td>"+JData[i]["book_number"]+"</td>";
str += "</tr>";
}
return str;
}
function theDom(data){
str = "<thead><tr>";
str += "<th>書名</th>";
str += "<th>作者</th>";
str += "<th>出版社</th>";
str += "<th>編號</th>";
str += "</tr></thead>";
str += "<tbody>";
str += booksLoop(data);
str += "</tbody>";
return str;
}
$.ajax({
url: "books.json",
type: "GET", //type:"GET"
dataType: "JSON",
success: function(data){
//console.log(data);
//console.log(data.length);
str = theDom(data);
//$("#books").html(str);
document.getElementById('database').innerHTML = str;
}
});
$(document).ready( function() {
$(".ui-loader").fadeOut(500);
});
$(document).ready(function() {
$("table#database").sieve({
searchTemplate:
'<div class="form-group"><input type="text" class="search form-control input-lg" placeholder="找書嗎?"</div>'
});
});
</script>
<style>
</style>
</head>
<body>
<div class="container">
<h2>臺東大學資訊工程學系圖書館</h2>
<p>系圖查詢系統</p>
<div class="ui-loader alert alert-success fade in" align="center">
<i class="fa fa-refresh fa-spin fa-1x fa-fw"></i> 載入中
</div>
<table id="database" class="table table-hover">
</table>
</div>
</body>
</html>