Update templates/Menu.html
Browse files- templates/Menu.html +9 -1
templates/Menu.html
CHANGED
@@ -159,6 +159,9 @@
|
|
159 |
];
|
160 |
|
161 |
function loadMenu() {
|
|
|
|
|
|
|
162 |
const menuContainer = document.getElementById("menu");
|
163 |
menuContainer.innerHTML = "";
|
164 |
menuItems.forEach(item => {
|
@@ -175,7 +178,12 @@
|
|
175 |
`;
|
176 |
menuContainer.appendChild(menuItem);
|
177 |
});
|
178 |
-
}
|
|
|
|
|
|
|
|
|
|
|
179 |
|
180 |
function logout() {
|
181 |
alert("Logged out successfully!");
|
|
|
159 |
];
|
160 |
|
161 |
function loadMenu() {
|
162 |
+
fetch('/get_menu')
|
163 |
+
.then(response => response.json())
|
164 |
+
.then(menuItems => {
|
165 |
const menuContainer = document.getElementById("menu");
|
166 |
menuContainer.innerHTML = "";
|
167 |
menuItems.forEach(item => {
|
|
|
178 |
`;
|
179 |
menuContainer.appendChild(menuItem);
|
180 |
});
|
181 |
+
})
|
182 |
+
.catch(error => console.error("Error fetching menu:", error));
|
183 |
+
}
|
184 |
+
|
185 |
+
document.addEventListener("DOMContentLoaded", loadMenu);
|
186 |
+
|
187 |
|
188 |
function logout() {
|
189 |
alert("Logged out successfully!");
|