forked from hebercg/ca2-webdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproducts.html
92 lines (83 loc) · 3 KB
/
products.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- other meta tags for SEO to follow later-->
<title>Products</title>
<!-- link stylesheet -->
<link rel="stylesheet" href="css/style.css" />
<!--Bootstrap links; includes Popper for now-->
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy"
crossorigin="anonymous"
></script>
<!-- JQuery -->
<script
src="https://code.jquery.com/jquery-3.7.1.js"
integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
crossorigin="anonymous"
></script>
<!-- when referring to scripts use -->
<script src="scripts/scripts.js"></script>
</head>
<body>
<header id="page-header"></header>
<nav
id="main-navigation"
class="navbar navbar-expand-lg navbar-light bg-light"
></nav>
<main>
<p>Hello, <span id="username"></span>! Browse our amazing products.</p>
<button id="show-products-button" onclick="showTable()">
Just show me the products
</button>
<button onclick="takeFlight()">Go on a journey</button>
<table id="product-table">
<thead id="product-table-head">
<tr>
<th>Name</th>
<th>Type</th>
<th>Origin</th>
<th>Price</th>
<th>Image</th>
<th>Properties</th>
<th>Description</th>
</tr>
</thead>
<tbody></tbody>
</table>
</main>
<footer></footer>
<script>
$(document).ready(function () {
$.getJSON("products.json", function (data) {
var tableBody = $("#product-table tbody");
$.each(data, function (index, value) {
var row = $("<tr></tr>");
row.append($("<td></td>").append(value.productName));
row.append($("<td></td>").append(value.beanType));
row.append($("<td></td>").append(value.origin));
row.append($("<td></td>").append(value.price));
row.append($("<td></td>").append(value.imageLink));
row.append($("<td></td>").append(value.properties));
row.append($("<td></td>").append(value.description));
tableBody.append(row);
});
});
});
</script>
</body>
</html>