I want to edit and write the data into the file which is on the disk and I want to save changes back to the same file using jquery. For this i have a button and textarea where I have edited the data and get the data before editing from json file as html5 :
function saveFile(data){
$.getJSON("../custom_scripts/sub.json", function(data){
var updatedData = $("#result").val();
$("sub.json").replaceWith(updatedData);
});
}
<form class="fileForm">
<input type="file" value="Choose file" onchange="onFileSelected(event)">
<br><br>
<textarea id="result" rows="20" cols="100"></textarea>
<button type="button" id="savable" class="btn btn-default" title="Save Changes" onclick="saveFile();"> Save</button>
</form>
After selecting the file the data gets edited and the additional data which I have entered is the updatedData but it