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:
AJAX.LastData
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:
http://www.jtadeo.com/scirra/ajax/ajaxexample1/