Why it doesn't return the value?
So basiclly I have a very simple function to get online players but it doesn't return to the value what I'm looking for.
- $(document).ready(function() {
- var ip = "mc.hypixel.net";
- loadPlayerCount(ip);
- window.setInterval(function() {
- loadPlayerCount(ip);
- }, 60000);
- });
- function loadPlayerCount(i) {
- $.get('https://eu.mc-api.net/v3/server/info/' + i, function(s) {
- if(s['status'] == false) {
- return -1;
- } else {
- return s['players']['online'];
- }
- });
- return -1;
- }