Skip to content

Instantly share code, notes, and snippets.

@ConnorMcF
Last active January 7, 2016 20:41
Show Gist options
  • Save ConnorMcF/6e9d08e1d163d4d4b303 to your computer and use it in GitHub Desktop.
Save ConnorMcF/6e9d08e1d163d4d4b303 to your computer and use it in GitHub Desktop.
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
function endgame(thename, finalscore) {
$.post( "http://hampus.connormcf.com/leaderboard/score.php?name=MYNAME&score=1", { name: thename, score: finalscore })
.done(function( data ) {
if(data == "true") {
// success!
} else {
// FAILED! :O
}
});
}
</script>
<script>
var whatone = 1; // start from one here, not zero
$.get("http://hampus.connormcf.com/leaderboard/get.php?id="+whatone)
.done(function( data ) {
var scoredata = _(obj).toArray();
console.log(scoredata['score'] + " - " + scoredata['name']);
}
.failed(function() {
alert( "uh oh failed" );
}
);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment