code cleanup
This commit is contained in:
20
web/game.js
20
web/game.js
@@ -710,23 +710,3 @@ function game() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendData(naam, score) {
|
|
||||||
const request = ( url, params = {}) => {
|
|
||||||
url += '?' + ( new URLSearchParams( params ) ).toString();
|
|
||||||
fetch( url );
|
|
||||||
};
|
|
||||||
const get = ( url, params ) => request( url, params);
|
|
||||||
|
|
||||||
get('https://oege.ie.hva.nl/~hossan/postData.php', { name: naam, score: score } );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function getData(){
|
|
||||||
// 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
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
requesteddata = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"></script>
|
||||||
<script src="js/basicbullet.js"></script>
|
<script src="js/basicbullet.js"></script>
|
||||||
|
<script src="js/Database.js"></script>
|
||||||
<script src="game.js"></script>
|
<script src="game.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
20
web/js/Database.js
Normal file
20
web/js/Database.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
function sendData(naam, score) {
|
||||||
|
const request = ( url, params = {}) => {
|
||||||
|
url += '?' + ( new URLSearchParams( params ) ).toString();
|
||||||
|
fetch( url );
|
||||||
|
};
|
||||||
|
const get = ( url, params ) => request( url, params);
|
||||||
|
|
||||||
|
get('https://oege.ie.hva.nl/~hossan/postData.php', { name: naam, score: score } );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function getData(){
|
||||||
|
// 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
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
requesteddata = data;
|
||||||
|
});
|
||||||
|
}
|
Reference in New Issue
Block a user