AJAX Example with Construct 2

  • 87 favourites



22,782 visits, 70,559 views



This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Capture the Returned Data

We now need a way to capture the returned data. This is where the AJAX.LastData property comes in.

In the Event sheet, we will add another event that will check to see if the AJAX event has completed.

Click Add event.

The Add event window appear. Select the AJAX object and click the Next button.

Double click the On completed condition.

For this tutorial, leave it as-is and click the Done button.

Our second event now appear in the Event sheet.

Click the Add action link.

Click on the txtReturnedData text object and click the Next button.

The action we want to use is the Set text action. Choose it then click the Next button.

In the Text input box, enter:


Our set up is done. Export the Construct 2 files and upload the files to the server. Make sure that you actually use a real target file that will return data.

You should be able to go to your page location, click the image and it will load the data. The earlier example we used is located at:



  • Order by
Want to leave a comment? Login or Register an account!