PDA

View Full Version : Update xml file on server with javascript


zali
06-12-2010, 08:10 AM
Hi all
I want to update a xml file using javascript. My xml file is on server, not client, so I think it is possible but I don't know how. I use javascript functions such as setElement or remove but xml file does not change.
Please help me!

Dormilich
06-12-2010, 09:41 AM
unless you have server-side JavaScript, you need a server side programming language (e.g. PHP, Perl, Java, ASP) to apply changes to the XML file*. if you want to use clinet side JavaScript, you need do use AJAX then.

* - works without a SSPL if your server supports the PUT request (though that is rather rare)

zali
06-12-2010, 11:18 AM
Thanks much
I think I should test Ajax

zali
06-13-2010, 07:05 AM
Does Ajax change xml file on client or only xml object on client?

Dormilich
06-13-2010, 01:43 PM
AJAX is a technique to interact with the server, nothing more, nothing less.

when you loaded the XML file, the client JavaScript uses an XML object which it operates on.

anything you do on the client doesn’t change anything on the server, including the original copy of the XML file. to change that, the client script has to communicate with the server and the the server side language has to apply the posted changes to the file.