Hello ,
I have requirement where i have update json static file values from form values entered by user once the form is submitted .
tried below script but i suspect its not reading json file to update
<script> function showMessage(myform){ // Read the JSON file const fs = require('fs'); let jsonData = JSON.parse(fs.readFileSync("test.json")); // Add or edit data jsonData.Test1.type = AJS.$(myform).find('#i_mydropdown').val(); // Write the JSON file fs.writeFileSync("test.json", JSON.stringify(jsonData)) } </script>
Are you trying to update a file in your local computer by executing a JavaScript in a browser?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.