PHP Sessions / AJAX / Construct2

Get help using Construct 2

Post » Sat Sep 28, 2013 6:26 pm

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!
B
3
Posts: 2
Reputation: 179

Post » Sat Sep 28, 2013 7:00 pm

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.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Sat Sep 28, 2013 8:36 pm

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!
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: gskunk and 44 guests