How do I use AJAX ?

Get help using Construct 2

Post » Sat Nov 01, 2014 5:27 am

Hello, I developed a webservice to a Login System for my game. And I see it's working fine.
You could see the attachments. There are two images, the conditions and the debug printscreen.

Conditions: As you can see, I just need to request some the url of my web service (I send it the user and the password), I tagged as Login, then when is completed I put the AJAX.LastData in a Text variable called "Existe". And then I compare if the Existe variable has the value "existe". If it is, then I want to see the Layout called Menu. That's all.
But this doesn't work, it never goes to Menu, even if the variable has the value "existe" on it.

You can see the attachment called Debug.png, where the LastData is the same of the value of the Existe Variable. But action never works and I just can't figure out why... I hope you can help me.

Thank you very much.
You do not have the required permissions to view the files attached to this post.
B
21
S
3
G
2
Posts: 86
Reputation: 2,262

Post » Sat Nov 01, 2014 1:30 pm

Could there be a space or newline at the end of the value you get back from the AJAX request?
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Sat Nov 01, 2014 3:21 pm

Thanks for answer @ramones. No, that's what I don't understand, if I put the AJAX.LastData I see it brings the value exactly as the condition compare without spaces or newline...
B
21
S
3
G
2
Posts: 86
Reputation: 2,262

Post » Sat Nov 01, 2014 3:26 pm

Ok!, it works now, but I don't really understand why. If I used a textbox instead of a string variable, it works!.

Updated:
Great!, I found the error and now I understand it...
You got right @ramones, there was a new line at the end of the response of my webservice. I was using at the response writeline instead of write so at the end I wasn't seeing but there was a newline as you mentioned.

Thank you very much for your help!
B
21
S
3
G
2
Posts: 86
Reputation: 2,262

Post » Tue Nov 25, 2014 8:39 am

Hi Folks,
Kindly assist.

I want to get the construct 2 array values(questions and answers) from construct 2 tool in certain condition(if player clicks the right answer or wrong answer).

Our idea is to find out how many times the user is clicking the right or wrong answers for a game.

We would like to capture the right & wrong events as well as answers to it. [Simple terms Game Analytic]

Please kindly assist us.
B
4
S
1
Posts: 10
Reputation: 370


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests