coverted database interactions and menu to classes

This commit is contained in:
Sam
2024-01-23 19:45:03 +01:00
parent cf843b80c8
commit 68005ea72b
6 changed files with 212 additions and 198 deletions

View File

@@ -1,15 +1,19 @@
class database{
sendData(naam, score) {
fetch(`https://oege.ie.hva.nl/~hossan/postData.php?name=${naam}&score=${score}`)
}
function sendData(naam, score) {
fetch (`https://oege.ie.hva.nl/~hossan/postData.php?name=${naam}&score=${score}`)
getData(name) {
// Fetch data from the database, put it in an array, and log it to the console
//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;
console.log(data);
});
}
}
function getData(name){
// Fetch data from the database, put it in an array, and log it to the console
//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;
console.log(data);
});
}