How do I send info to a JSON file on server?

Get help using Construct 2

Post » Thu Sep 11, 2014 10:21 am

I have on my server a parent html files containing 2 child html files embedded with iframe. The idea is that one of the frames (containing animations) need to retrieve some data/variables from the other one (control panel) or from the parent html file, and I decided to use a JSON file. (all files are on the same domain/server)
Using AJAX.RequestURL I CAN read the JSON (using relative path) but when it comes to write back to JSON I'm stuck.
I have no idea how to use AJAX or PHP and I thought that sending the data to the url of the JSON file will modify it, but that is just silly thinking, I admit:)
Is there a way to do this without using PHP or other complex things outside C2 ?
I am doing this for someone that has no idea of C2 and he wants to modify the behavior of an animation on his own, from outside the animation html.
Here is what I'm talking about if I did not explained properly:
http://synapse1one.com/tests/rainwater_temp/index_2_iframes.html
and this is the capx for the right-hand side frame https://dl.dropboxusercontent.com/u/139926126/Forums/scirra/test_JSON.capx
Please, if anyone is having any ideas ,any suggestions are welcome.
I don't expect for someone else to do it for me but to give me a hint
Thanks guys
B
82
S
21
G
23
Posts: 517
Reputation: 18,731

Post » Thu Sep 11, 2014 10:29 am

no, you can't ... a json file is just a simple text file with content. Being able to make changes to the file on the server would mean that you have a very big security issue (everyone would be able to just access it and make changes, even outside of your app).

I'm sorry to tell, but you will need a PHP, Perl, ASP, ... Script in order to make changes on server hosted files.
B
44
S
10
G
8
Posts: 437
Reputation: 6,468

Post » Thu Sep 11, 2014 3:39 pm

@Ubivis That is a bad news. I will see what I can do eventually, Thanks
B
82
S
21
G
23
Posts: 517
Reputation: 18,731


Return to How do I....?

Who is online

Users browsing this forum: jezjones24, Lancifer, matriax, newt, R0J0hound and 25 guests