开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜