Update js/fase2.js
This commit is contained in:
+3
-2
@@ -249,7 +249,7 @@ function mostraFineGioco() {
|
|||||||
const score2 = parseInt(localStorage.getItem('punteggioFase2')) || 0;
|
const score2 = parseInt(localStorage.getItem('punteggioFase2')) || 0;
|
||||||
const scoreT = 10_000 * ((score1 / MAX_SCORE) + (score2 / MAX_SCORE)) / 2;
|
const scoreT = 10_000 * ((score1 / MAX_SCORE) + (score2 / MAX_SCORE)) / 2;
|
||||||
const data_partita = new Date().toISOString().split('T')[0]; // Formato YYYY-MM-DD
|
const data_partita = new Date().toISOString().split('T')[0]; // Formato YYYY-MM-DD
|
||||||
fetch('http://localhost:8888/php/save_score.php', {
|
fetch(`${SERVER_URL}/php/save_score.php`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
@@ -265,9 +265,10 @@ function mostraFineGioco() {
|
|||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
console.log("Punteggio salvato con successo:", result);
|
console.log("Punteggio salvato con successo:", result);
|
||||||
|
window.location = "?pagina=end";
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Errore nella richiesta:", error);
|
console.error("Errore nella richiesta:", error);
|
||||||
|
window.location = "?pagina=end";
|
||||||
});
|
});
|
||||||
window.location = "?pagina=end";
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user