//solved

Discussion in 'Programming' started by PurrfectMistake_, Aug 1, 2018.

Thread Status:
Not open for further replies.
  1. ok, so for some reason the person who coded the site i manage didn't set up the query properly to see how many players are online. This is the code where the issue is coming from. Anyone able to help?

    HTML:
                <span style="white-space:nowrap;position:absolute;font-size:20px;font-family: 'Open Sans', sans-serif;font-weight:300;color:#F8F8F8;margin-left:500px;margin-top:-20px;">PLAYERS ONLINE: <span style="white-space:nowrap;font-size:20px;font-family: 'Open Sans', sans-serif;font-weight:300;color:#0bcdf6" id="ServerCount2"></span></span>
            </div>
        </div>
        <div id="lowerpart">
        <li id="UserWelcome" style="position:absolute;z-index:9999;margin-left:1400px;margin-top:21px;font-size:18px;font-weight: 300;" class="opt"><i style="margin-top:-27px;" class="fa fa-child"></i>&nbsp;&nbsp;Welcome, <a style="font-weight: 400; font-weight: bold;" id="UserVariable"></a>&nbsp;<a id="UserImg"></a></li><li id="UserAdmin" style="position:absolute;z-index:9999;margin-left:500px;margin-top:21px;font-size:20px;" class="opt"><a style="font-weight: 300;" href="/admin"><i style="margin-top:-27px;" class="fa fa-user"></i>&nbsp;&nbsp;Admin</a></li><span style="position:absolute;z-index:9999;margin-left:1400px;margin-top:21px;font-size:18px;" id="notonline"><a href="/login"><span class="nol" style="color:#f8f8f8; font-weight: bold;">Login</span></a>&nbsp;&nbsp;<span style="color:#f8f8f8;">/</span>&nbsp;&nbsp;<a href="/login/do/register"><span class="nol" style="color:#f8f8f8; font-weight: bold;">Register</span></a></span>
    <li id="UserJoin" style="position:absolute;z-index:9999;margin-left:400px;margin-top:21px;font-size:20px;" class="opt"><a href="#" onclick="Enjin_Core.joinWebsiteRegular(event);return false;" rel="nofollow"><i style="margin-top:-27px;" class="fa fa-user"></i>&nbsp;&nbsp;Join Website</a></li>
    <!--<li class="opt2" style="position:absolute;right:705px;font-size:15px;font-family:'Open Sans',sans-serif;font-weight:300;top:80px;z-index:1;"><a class="apply" href="/application">Apply for staff</a></li>-->
        <div align="center" id="secondrow">      
            <span style="position:absolute;font-size:20px;font-family: 'Open Sans', sans-serif;font-weight:500;color:#0bcdf6;width:500px;margin-left:auto;margin-right:auto;left:0;right:0;margin-top:14px;">PLAYERS ONLINE: <span style="font-size:18px;font-family: 'Open Sans', sans-serif;font-weight:300;color:#0bcdf6" id="ServerCount1"></span></span>
    Code (Java):
    $(document).ready(function() {
        function playerCheck() {
            $.ajax({
                type: 'GET',url: 'http://mcapi.us/server/status',data: {ip: 'PLAY.MINEARCH.ORG', keepUpdated: true}
            })
            .done(function(status) {$("#ServerCount1, #ServerCount2").text(status.players.now);});
        }
     
        playerCheck();
     
        setInterval(function() {
            playerCheck();
        },5000)
     
        $("#ServerCount1").click(function() { playerCheck() });
    });
     
     
    #1 PurrfectMistake_, Aug 1, 2018
    Last edited: Aug 1, 2018
Thread Status:
Not open for further replies.