Creating or Changing a xml element with javaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Creating or Changing a xml element with javaScript

When I create a xml element with javaScript; If I close to documents, Does That xml element go? Or If I change an xml element on javaScript, If I close to documents Does that xml elements change again ? I mean Can I use xml as a database ?

7th Jun 2017, 3:26 PM
Serhat Merak
Serhat Merak - avatar
3 Answers
+ 1
For local client access: Javascript can read local xml file by using XMLHttpRequest. But Javascript is not allowed to write to local file from any client browser for security reason. For server data update: Javascript that run from client browser has no capability to update any server files or database. It has to send Ajax request to server, then server script like php or NodeJs handles the read/write data access to/from Xml or database. So my answer is: You cannot use xml as database with Javascript only.
7th Jun 2017, 4:24 PM
Calviղ
Calviղ - avatar
+ 1
Thank you Calvin 😊😊
7th Jun 2017, 4:26 PM
Serhat Merak
Serhat Merak - avatar
0
You can use local storage or cookie but that only limit to individual client machine only. Different clients would have their own set of data, cannot share within.
7th Jun 2017, 4:31 PM
Calviղ
Calviղ - avatar