added name parameter for requesting data with name

This commit is contained in:
sam
2024-01-17 15:39:48 +01:00
parent ab35b7817a
commit 7ef09f73fc

View File

@@ -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 // 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(response => response.json())
.then(data => { .then(data => {
requesteddata = data; requesteddata = data;