PHP Sessions / AJAX / Construct2

0 favourites
  • 3 posts
From the Asset Store
Paypal PHP Supports multiple platforms, Web/html5 Android, IOS. (Including storing transaction data)
  • I'm rather new to Construct2 but have managed to create a game and now want to add in some AJAX for updating things like scores etc.

    Basic AJAX stuff is working just fine in that I can make an AJAX request to one of my PHP pages and get the results. (Which I dump into a text box in the game just for debugging/viewing purposes)

    The trouble comes when I try to use PHP sessions related to that AJAX request. As a simple test I just have my PHP script echoing back a brief bit of text followed by the PHP session ID. When I just have text echoing back (eg. "Hello") it works fine. When I add the session ID it isn't displayed in my game. (No text displays at all) To make sure everything in my backend code is working I wrote a simple AJAX request using JQuery in the same page as I load my game making the same AJAX request and I get the text plus the session ID back as expected.

    So my question is - what is going wrong that I can't get the same info displayed in Construct2 as I can using jQuery AJAX calls on the same page as my game?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is the session ID immediately after the text, like "Hello83498573487534..."? If the text box isn't large enough for the text then it wouldn't display anything. You could try logging the result to the console.

  • Well aren't you just awesome! That's all it was. I just assumed it would truncate the string. Silly assumption apparently!

    Thanks for your help!

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