-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeal.html
125 lines (116 loc) · 4.08 KB
/
meal.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>오늘의 급식</title>
<style>
body {
font-family: 'Arial', sans-serif;
margin: 0;
padding: 0;
background-color: #181818;
color: #d898e2;
}
.container {
width: 80%;
margin: 20px auto;
padding: 20px;
background-color: #282828;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
margin-bottom: 20px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
text-align: left;
padding: 10px;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f0f0f0;
}
.meal-item {
display: flex;
align-items: center;
}
.meal-image {
width: 50px;
height: 50px;
margin-right: 10px;
}
.meal-name {
font-weight: bold;
}
.meal-description {
margin-left: 10px;
}
</style>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="/">메인 페이지</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/meal">식단표</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<h1>오늘의 급식</h1>
<table id="mealTable">
<thead>
<tr>
<th>시간</th>
<th>메뉴</th>
<th>설명</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
$.ajax({
type: "GET",
url: "api/meal",
dataType: "json",
success: (d) => {
let data = JSON.parse(d).data;
const mealTable = document.getElementById("mealTable").getElementsByTagName("tbody")[0];
for (let i = 0; i < data.length; i++) {
const row = mealTable.insertRow();
const timeCell = row.insertCell();
const menuCell = row.insertCell();
const descriptionCell = row.insertCell();
timeCell.innerHTML = data[i].time;
menuCell.innerHTML = data[i].menu;
descriptionCell.innerHTML = data[i].description;
}
},
error: (error) => {
console.log(error);
}
})
</script>
</div>
</body>
</html>