How to submit a score to a scoreboard with JQuery


Posted: 2018-11-30 19:23:52 |    Posted by iDev |    idevgames.co.uk

2
Login to like

Submitting a score with JQuery is very simple. Below is an example that will post a score when the page is loaded. Update the URL and the scoreboard key from your edit game page once you have created a scoreboard. This example won't work until you have uploaded your files on to the site.

<html>
<head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
</head>
<body>
<script>
$.ajax({
type: 'POST',
url: 'your Post URL',
data: {
'scoreboardKey': 'your_scoreboard',
'name': 'Test',
'score': 100
},
success: function(msg){
alert('Success ' + msg);
}
});
</script>
</body>
</html>
 

Also take a look at how to do this in construct 2, it will give you an idea of how the scoreboard settings work:

Would you like to comment on this post? Create an account in less then 1 minute Click here

0
Login to like
2 years ago
Huemerson Commented:

Very good, it will help a lot, thank you.



Back to top

Bump Reminder CiveRo DISBOARD Dyno GameAddict GYR0SK4
8 Online Discord
·