1

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) { 

});
1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.