-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpets.html
More file actions
73 lines (72 loc) · 2.11 KB
/
pets.html
File metadata and controls
73 lines (72 loc) · 2.11 KB
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Pets on sale</title>
<link
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="styles/styles.css" />
<script src="./node_modules/jquery/dist/jquery.js"></script>
<script>
$(document).ready(() => {
$.ajax({
type: "GET",
url: "/petlist",
dataType: "json"
}).done(r => {
console.log(r);
$.each(r, (i, p) => {
$("#tblBody").append(
`<tr>
<td><img class='img-circle' src='${
p.picture
}' width='50px' /></td>
<td>${p.petName}</td>
<td>${p.type}</td>
<td>${p.price.toFixed(2)}</td>
<td>${p.description}</td>
<td>
<a href="/edit/${p.id}" class="btn btn-primary">Edit</a>
</td>
</tr>`
);
});
});
});
</script>
</head>
<body>
<nav class="navbar">
<a href="index.html" class="brand">Pets On Sale</a>
<ul class="navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="pets.html">Pets</a></li>
</ul>
</nav>
<div class="container full-width">
<h1 style="margin: .75rem .5rem;">Pet List</h1>
<div class="bar right">
<a href="add.html" class="btn btn-primary">Add New</a>
</div>
<table class="table" cellspcing="0">
<thead>
<tr>
<th></th>
<th>Pet Type</th>
<th>Pet Breed</th>
<th>Price</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tbody id="tblBody"></tbody>
</table>
</div>
<footer class="footer">
<p>Project by Afroza Jabib, 1255708</p>
</footer>
</body>
</html>