App42 Shephertz Javascript Leaderboard

55 Views Asked by At

I am trying to get a leaderboard to work using app42 by shephertz

Here is my code, but I just get a blank page showing - what am I doing wrong?

I have pre-populated the leaderboard with two entries directly using the console on the app42 website, so I would expect the below to pull and display the two entries on my page?

    <html>

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>test</title>
    <script src="src/App42-all-3.1.min.js"></script>
    </head>

    <body>
    <script>
    App42.initialize("xxxxxxx","xxxxxxxxx");

    var gameName = "xxxx",
    max = 10,
    result ;  
    scoreBoardService.getTopNRankers(gameName,max,{  
        success: function(object) 
        {  
    var game = JSON.parse(object);  
    result = game.app42.response.games.game;
    console.log("gameName is : " + result.name)
    var scoreList = result.scores.score;
    for(var i=0;i<scoreList.length;i++)
    {
        console.log("userName is : " + scoreList[i].userName)
        console.log("scoreId is : " + scoreList[i].scoreId)
        console.log("value is : " + scoreList[i].value)
    }
    },  
    error: function(error) {  
    }  
    }); 

    </script>
    </body>

    </html>
0

There are 0 best solutions below