javascript xml saving problem
I want to modify some data on XML file residing on server side by using javascript.
I'm using following code
var xh;
if(window.XMLHttpRequest开发者_开发问答)
{
xh=new XMLHttpRequest();
}
else
{
xh=new ActiveXObject("Microsoft.XMLHTTP");
}
xh.open("get","books.xml",false);
xh.send("");
var xdoc=xh.responseXML;
var x=xdoc.getElementsByTagName("title");
x[0].getAttributeNode("lang").nodeValue="zh";
xh.save("books.xml");
but its not working
Thanks in advance, Guru
You can’t edit files on a server using JavaScript (unless your server is running Node.js, but that’s a whole different story). JavaScript is a client-side language; you’ll need a server-side language if you want to write to a file.
精彩评论