function saveScore(score) { fetch('Score.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'score=' + encodeURIComponent(score) }) .then(response => response.json()) .then(data => { if (data.status === "success") { console.log("Skor berhasil disimpan!"); } else { console.log("Gagal menyimpan skor:", data.message); } }) .catch(error => console.error("Error API:", error)); }