开发者

Open, edit and save a text file using XMLHttpRequest and javascript

i ne开发者_Go百科ed to update a text file in my website, i need to open it then view that text then retype the text on it it and then save it back to the server.

i am able to open the file using XMLHttpRequest, i can view the text on the file, now i need to over write the text on that file with text that i would input from a webpage, how can i do that using javascript and XMLHttpRequest? thanks.


Unfortunately, you cannot do that with only the JavaScript technology. You will have to use another technology in order to write to your file.

You can use PHP for instance and use the

fwrite($fp, "The text coming from XMLHttpRequest");

method ( http://www.php.net/fwrite )


In addition you need a serverside service (ASP.Net / PHP etc.) to handle the file IO, its a good thing this can't be done by just Javascript and XMLHttpRequest

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜