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) {
});
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.