From 7ef09f73fc0dd3858968b4553165483e665019fc Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 17 Jan 2024 15:39:48 +0100 Subject: [PATCH] added name parameter for requesting data with name --- web/js/Database.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/js/Database.js b/web/js/Database.js index c46eb7c..b82b927 100644 --- a/web/js/Database.js +++ b/web/js/Database.js @@ -10,9 +10,10 @@ function sendData(naam, score) { } -function getData(){ +function getData(name){ // Fetch data from the database, put it in an array, and log it to the console - return fetch ('https://oege.ie.hva.nl/~hossan/getData.php') // Add return here + //met backticks als " " kan je variabelen in een string zetten + return fetch (`https://oege.ie.hva.nl/~hossan/getData.php?name=${name}`) // Add return here .then(response => response.json()) .then(data => { requesteddata = data;