JSON response AJAX from my API website

1 favourites
  • 3 posts
From the Asset Store
This is a single chapter about "Decision Science" strategy games from the "Construct Starter Kit Collection" workshop.
  • Hi mates I'm creating a leaderboards website for HTML5 games so i'm trying to integrate Construct 3.

    I already success on create player, set player score and get player score, but when i try to display all scores of the game...

    The website accept a game generate a Game ID, API secret key so in the AJAX request from Construct 3 project, add the url to send a POST request, with that data the Game ID and Secret API key.

    As you can see the PHP API is ok and returns a JSON encoded data of allplayers scores of the game.

    This is what i have so far.

    The console and AJAX response you see all the data is there but I can't get it loaded in the JSON element in Construct 3.

    Is this because of limit of Free version?

    How i can parse the allplayers data?

    Here is the project

    Thanks

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • in event 2 you need to "parse" the AJAX.LastData to get the JSON object ready to use...

    the allplayers data is an array inside the JSON object so you need to specify an index to the entry you want (or set the path)

    I used your count variable (I made it global for debugging, but that isn't necessary)

    you will need a reliable way to associate each entry with your text objects, I just pick one by its instance ID, but that will only work it they were created in the order you want.

  • Thank you so much works like a charm.

    when I end with all the todos of the project I will update the post so everyone can read in future.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)