How do I use AJAX ?

0 favourites
  • 5 posts
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could there be a space or newline at the end of the value you get back from the AJAX request?

  • Thanks for answer 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...

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


    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!

  • 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.

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