I was looking everywhere, but i can not really find how to add new node to JSON file which is located at localhost... Please share with some code.
All i have got is :
$.getJSON( 'demo.json', function(data) {
});
I was looking everywhere, but i can not really find how to add new node to JSON file which is located at localhost... Please share with some code.
All i have got is :
$.getJSON( 'demo.json', function(data) {
});
getJSON only retrieves the data. You can add a node to the retrieved data in the callback function if you like, so you can use it in the rest of your application.
If you want the new node to be appended and saved to the file, you need to write the new data to the file on the server. This cannot be done from the client. Of course, you can send the new data to the server using AJAX and save the file there.