I have a Phaser game that runs just fine. I need to submit score to my server which has a action that can accept the score. Is this possible?
Hello you can try this :
var my_score = 20;
function submit_score(my_score) {
var fd = new FormData();
fd.append("my_score", my_score);
var xhr = new XMLHttpRequest();
xhr.open('POST', 'post.php', true);
xhr.send(fd);
}
here is the PHP file
<?php
$score = $_POST["my_score"];
echo $score;
?>