-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
47 lines (47 loc) · 1.34 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
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="/view/css/normalize.css" />
<link rel="stylesheet" type="text/css" href="/view/css/bootstrap_5_3.css" />
<link rel="icon" href="/view/img/burger-32.png" />
<script
type="text/javascript"
src="/model/libs/ajax_1_6_2_min.js"
></script>
<title>Odin Recipes</title>
<script>
fetch("/view/navbar.html")
.then((response) => response.text())
.then((navbar) => {document.querySelector("#navbar-div").innerHTML = navbar;
});
</script>
</head>
<body>
<div id="navbar-div"></div>
<script>
//display list of titles of recipes from data/recipes.json
$(function () {
$.getJSON("/data/recipes.json", function (data) {
var items = [];
$.each(data, function (key, val) {
items.push(
"<li id='" +
key +
"'>" +
"<a href='/view/recipe.html?id=" +
val.id +
"'>" +
val.title +
"</li>"
);
});
$("<ul/>", {
class: "my-new-list",
html: items.join(""),
}).appendTo("body");
});
});
</script>
</body>
</html>