-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.html
63 lines (61 loc) · 2.06 KB
/
log.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./node_modules/[email protected]@bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="./css/public.css">
<link rel="stylesheet" href="./css/log.css">
<title>Document</title>
</head>
<body>
<table class="table table-hover">
<tr>
<td>药品编号</td>
<td>药品名称</td>
<td>操作</td>
<td>操作人</td>
<td>日期</td>
</tr>
<!-- 表单内容 -->
<tbody id="list"></tbody>
</table>
</body>
</html>
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
//记录当前页面信息
localStorage.setItem("url", "log.html");
render();
})
function render() {
//从数据库获取用户列表
$.ajax({
type: "POST",
dataType: "json",
url: "./php/getLog.php",
data: {},
success: function (res) {
// console.log(res);
// console.log(typeof (res));
var data = res;
var str = '';
// 注意:输出的i与obj分别为下标与单个的对象
$.each(data, function (i, obj) {
// console.log(i);
// console.log(obj);
str += '<tr>';
str += '<td class="medid">' + obj.medid + '</td>';
str += '<td class="medid">' + obj.medid + '</td>';
str += '<td class="type">' + obj.action + '</td>';
str += '<td class="price">' + obj.person + '</td>';
str += '<td class="medname">' + obj.date + '</td>';
str += '</tr>';
});
$("#list").append(str);
}
});
}
</script>