How do I Include a JS file and access a JSON from the script

Get help using Construct 2

Post » Fri Oct 16, 2015 7:42 am

Good day all,

A quick question please, how do I ...
1. Include a JavaScript file into my project
2. Access a JSON object returned from function in the script

I'm trying to include a JS file in my project, as well as make a REST API call and retrieve a JSON response back and also display data from the JSON on Text views in C2 and also save some returned data into a variables with which I can manipulate and work with.

Any help/guide would be greatly appreciated
Posts: 5
Reputation: 208

Post » Fri Oct 16, 2015 9:07 am

Thank you very much Lordshiva1948 for your response. The tutorial is not exactly what I want though. I really do want to be able to call a function in a JavaScript file which I will include in my project.

Reason being that I should be able to make my REST API calls from the function in the Javascript file and then be able to access a JSON response back in C2.

Or if there's a better way to do this, I'll really appreciate it a lot. Thanks once again.
Posts: 5
Reputation: 208

Post » Fri Oct 16, 2015 8:32 pm

You can use the ajax object to request your json file, then once it is loaded, use the ' ajax on completed' to manipulate your json data or use a php script, to manipulate you json results.
Super Soccer Skills\Bushy Ball\Sticky Web\Snake
Image ImageImageImage
During the gold rush it was a good time to be in the pick and shovel business
Posts: 273
Reputation: 7,298

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests