How can i save html data in json file. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i save html data in json file.

i am creating stock management web application using JavaScript and want to save html form data in json file, can anyone help also please explain the method.

25th Jan 2018, 7:28 AM
Qubit
Qubit - avatar
14 Answers
+ 4
@qubit, we use asp to generate html pages from server sides using a script, in .NET platform similarly like we use jsp in java platform, I ll suggest not to go that way, use json instead of XML if possible , parsing is so much easier, and try nodejs, since u already know JavaScript try nodejs tutorials by The Net Ninja, videos are very short and to the point, you ll find your answers in one of those videos hopefully.
25th Jan 2018, 3:09 PM
Morpheus
Morpheus - avatar
+ 7
it's generally done by a Backend program using action attribute , u ll need something like AJAX with some server side language , node , etc but you can dig deeper here https://www.xmlfiles.com/articles/saving-html-form-data-to-xml/ doubts like this makes me disappointed , and that's when I think that's it now I need to learn backend, I ll highly suggest node js
25th Jan 2018, 11:03 AM
Morpheus
Morpheus - avatar
3rd Feb 2018, 11:47 AM
Morpheus
Morpheus - avatar
+ 4
@qubit, I ll give it a try share it👍
3rd Feb 2018, 10:49 AM
Morpheus
Morpheus - avatar
+ 4
you can meet me at https://sololearndevconnect.slack.com, my I'd is Morpheus
3rd Feb 2018, 11:04 AM
Morpheus
Morpheus - avatar
+ 4
ok, 👍other SoloLearner s hang out there too, it's a good place to connect
3rd Feb 2018, 11:36 AM
Morpheus
Morpheus - avatar
+ 3
You can only read xml but can't write xml using JavaScript due to client browser security concerns.
25th Jan 2018, 10:36 AM
Calviղ
Calviղ - avatar
+ 3
yup, missed an s in articles , now it's there
25th Jan 2018, 12:13 PM
Morpheus
Morpheus - avatar
+ 2
as @morpheus said, i also have searched this on google and visited to xmlfiles.com the previous days and i found Microsoft XMLDOM also that i need to be familiar with ASP to work with it.
25th Jan 2018, 12:14 PM
Qubit
Qubit - avatar
+ 2
hey @morpheus, i have searched about json and also starts to implement to save form data in json using ajax to fetch data from the form and to read and write data in json using JSON.stringify() and JSON.parse() methods in json but there's an error in my programme that after the conversion of the form data into json object using stingify, only thing goes wrong at the if statement when i check for (request.readyState == 4 && request.status == 200) but the XMLHttpRequest always has readyState = 1 and status = 0 when i do console.log(request); i faced problems in the starting but going on my way i have resolved them all and i think this is the last problem! can u help me? i can send u my html and JavaScript code if u want ... waiting for ur quick response, need help.
3rd Feb 2018, 10:19 AM
Qubit
Qubit - avatar
+ 1
i just guess that its a type of language.. make me correct if anyone knows about that!
25th Jan 2018, 3:02 PM
Qubit
Qubit - avatar
+ 1
thank you @morpheus for the discussion and also to help me. i will do search for them.. :-)
26th Jan 2018, 2:17 PM
Qubit
Qubit - avatar
+ 1
@morpheus, how i be the part of the sololearndevconnect.slack.com workplace
3rd Feb 2018, 11:44 AM
Qubit
Qubit - avatar
0
please wait as i am singing in to the just installed slack.. come 2 u there
3rd Feb 2018, 11:31 AM
Qubit
Qubit - avatar