Is it possible to add elements to an xml file permanently using javascript?
by admin on May.02, 2010, under Javascript
I am using the examples on w3schools and as far as i can tell creating or adding an element with javascript only makes that element accessible through javascript. I want to actually write a new element in to my XML file. How can i do this?


May 2nd, 2010 on 11:15 am
Javascripts don’t have access to files, Period.
You can’t write to a file using javascript.
But there are some workaround.
You can use XMLHttpRequest object(Ajax) or
You can use filesystem object in Windows Scripting Host or Internet Explorer in a trusted environment.
http://www.javascripter.net/faq/fileacce.htm
May 2nd, 2010 on 11:32 am
You’ll need some kind of server side language (ASP,PHP) to perform this for you.
Write a small piece of server side code that accepts parameters and which then performs your permanent change to your xml file. Call the .asp or .php file using an ajax request in javascript.