From c1c53de953d4ec095f613e42336445af79e45edd Mon Sep 17 00:00:00 2001 From: LarsLindain Date: Thu, 23 Jan 2025 15:34:01 -0800 Subject: [PATCH 1/3] it dont work anymore :( --- navigation/logicgatesgame/lgates.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/navigation/logicgatesgame/lgates.md b/navigation/logicgatesgame/lgates.md index a1c16dc..eb24d5c 100644 --- a/navigation/logicgatesgame/lgates.md +++ b/navigation/logicgatesgame/lgates.md @@ -106,6 +106,7 @@ permalink: /logicgame + \ No newline at end of file + From 93b1b5e8fb5ca579ce2993e1ed8bc139fe981b9f Mon Sep 17 00:00:00 2001 From: LarsLindain Date: Thu, 23 Jan 2025 21:59:49 -0800 Subject: [PATCH 2/3] this should work now --- navigation/logicgatesgame/lgates.md | 60 ++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/navigation/logicgatesgame/lgates.md b/navigation/logicgatesgame/lgates.md index eb24d5c..2733fba 100644 --- a/navigation/logicgatesgame/lgates.md +++ b/navigation/logicgatesgame/lgates.md @@ -102,10 +102,25 @@ permalink: /logicgame - + + + + + + + + + + + + + + + +
NameScore
+ +async function fetch_Data() { + try { + const response = await fetch("http://127.0.0.1:8887/api/lgate", { + method: "GET", // Assuming the backend supports GET for retrieving all records + headers: { + "Content-Type": "application/json", + }, + }); + + if (response.ok) { + const data = await response.json(); + const tableBody = document.querySelector("#dataTable tbody"); + + // Clear existing table data + tableBody.innerHTML = ""; + + // Populate table with fetched data + data.forEach((item) => { + const row = document.createElement("tr"); + const nameCell = document.createElement("td"); + const scoreCell = document.createElement("td"); + + nameCell.textContent = item.name; + scoreCell.textContent = item.score; + + row.appendChild(nameCell); + row.appendChild(scoreCell); + tableBody.appendChild(row); + }); + + alert("Data retrieved successfully!"); + } else { + const result = await response.json(); + alert(`Error: ${result.error}`); + } + } catch (error) { + console.error("Error:", error); + alert("Failed to fetch data from the server."); + } +} + \ No newline at end of file From 7bf3d7ec90ca46d1766a0eaa4106092703ad357d Mon Sep 17 00:00:00 2001 From: LarsLindain Date: Fri, 24 Jan 2025 14:45:48 -0800 Subject: [PATCH 3/3] update --- navigation/logicgatesgame/lgates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/navigation/logicgatesgame/lgates.md b/navigation/logicgatesgame/lgates.md index 2733fba..07af687 100644 --- a/navigation/logicgatesgame/lgates.md +++ b/navigation/logicgatesgame/lgates.md @@ -107,7 +107,7 @@ permalink: /logicgame - +