How do I exchange informations using Ajax?

Get help using Construct 2

Post » Tue Aug 16, 2016 8:03 pm

I would like to understand how I can do to send and get informations from the server using AJAX. I don't need to make any changes on server hosted files. I also don't need to register anything in the database.

What I need:
1_ send the question number and answer that the user has chosen (e.g. user_id=1 / question_id=1)
2_ get the information about the next action (e.g. show video_id)
3_ send information when the video ends (go to question_id 2)

I'm using the action AJAX - Request URL to get data and it works. I'm also using the action AJAX - Post to URL to send the information and I'm getting error through the event "tag" error > set text to "Failed".

I really appreciate an example showing this procedures working or even a simulation.

Thanks in advance.
Posts: 1,050
Reputation: 8,205

Post » Thu Aug 18, 2016 2:22 pm

You use HTTP GET or POST requests to transfer information using AJAX.

Are you in control of your server code? If your GET request works, but your POST does not, then I would look at the server side code for your POST requests.

I use Java servlets to handle GET and POST requests to my server, and it goes something like this: ... n-servlets
or ... va-servlet
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
Posts: 1,419
Reputation: 4,867

Return to How do I....?

Who is online

Users browsing this forum: DH The Animtor, oosyrag and 0 guests