Skip to content

Commit

Permalink
Add orderID to confirmation page
Browse files Browse the repository at this point in the history
-Fix URL parameter in cart.js
  • Loading branch information
w3dd1e committed Dec 9, 2023
1 parent 1ca63db commit 1c89d2e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion front/js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ form.addEventListener("submit", (event) => {
})
.then((response) => response.json())
.then((data) => {
window.location.href = "./confirmation.html?=" + data.orderId;
window.location.href =
"./confirmation.html?orderId=" + data.orderId;
});

alert("Thank you for your order!");
Expand Down
5 changes: 5 additions & 0 deletions front/js/confirmation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const url = new URL(window.location.href);
const urlParams = new URLSearchParams(url.search);
const orderID = urlParams.get("orderId");

document.getElementById("orderId").textContent = `${orderID}`;

0 comments on commit 1c89d2e

Please sign in to comment.