-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
37 lines (32 loc) · 1020 Bytes
/
Copy pathscripts.js
File metadata and controls
37 lines (32 loc) · 1020 Bytes
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
document.addEventListener("DOMContentLoaded", function() {
fetch("getReview.php")
.then(response => response.json())
.then(reviews => {
const tableBody = document.querySelector("#reviewTable tbody");
tableBody.innerHTML = reviews
.map(review => {
return `
<tr>
<td>${review.Username}</td>
<td>${review.Rev_id}</td>
<td>${review.Res_name}</td>
<td>${review.Rev_comment}</td>
<td>${review.Fav_item}</td>
<td>${review.I_comment}</td>
</tr>`;
})
.join("");
})
.catch(error => console.error("Error fetching reviews:", error));
})
plusButton.addEventListener("click", function () {
addReview.classList.add("show");
});
closePopup.addEventListener("click", function () {
addReview.classList.remove("show");
});
window.addEventListener("click", function (event) {
if (event.target == addReview) {
addReview.classList.remove("show");
}
});