开发者

Writing to File in Server-Side Javascript

I'm studying Web Applications at university, and at the moment we have an assignment: build a 'blog' using only CSS, Javascript and XML. We have to store the blog posts in a .xml file, which is what's got me stuck at the moment.

So, essentially I need to be able to write a Javascript function which writes to a server-side file. There are so many better ways to do this but we literally have to do it in Javascript. The teacher is totally unhelpful and everyone I asked thinks it can't be done.

I don't want anyone doing my work for me or anything, just it'd be nice to know how to do this, if it's even possible.

C开发者_运维技巧heers in advance.


If you are talking about JavaScript running in a browser, then you have to write some JavaScript that makes an HTTP request (possibly using XMLHttpRequest) to a server side process that will write the file. The client can't write directly to the server's filesystem.

If you are talking about JavaScript running on the server, then it depends on your JavaScript environment. There are lots of different ones: http://en.wikipedia.org/wiki/Server-side_JavaScript

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜