Read/write Json From Js To File On Server (not Server App)
Solution 1:
You can open a file located on the server via ajax by querying the file and loading it into a JSON object. You might want to LINT your JSON
You can not write to an object on the server via the client. This is a severe security breach. Common practice is to change the JSON data and then send it via ajax to server-side code. The server will then do the file IO.
Yes using JSON.parse otherwise eval is indeed correct. I would recommend json2.js
The data should be fine as long as it passes JSONLint.
Your main issue is that it's impossible to write to the server from the client. Get the client to load the data through ajax change it and then query the server to update the file.
Solution 2:
js don't have i/o property;
you should use ajax or http request to send message to server,and tell server to do de i/o action...
Post a Comment for "Read/write Json From Js To File On Server (not Server App)"