用jQuery编写服务器上的文件?

时间:2021-11-09 00:04:49

I am developing an application which requires the reading and writing of XML files. Reading I've got covered, but is writing possible at all? The layout of my webapp is like this:
../includes/ (irrelevant)
../content.xml (xml to be written to)
../index.html (irrelevant)
../admin.html (file to write with)
Any help appreciated, thanks.

我正在开发一个需要读写XML文件的应用程序。我已经写过了,但是写作真的可能吗?我的webapp的布局是这样的:/ / . . /(无关紧要的)内容包括。xml(要写入的xml) .. ./索引。html(无关紧要的). . / admin。html(要写的文件)需要任何帮助,谢谢。

2 个解决方案

#1


5  

You will need to write some type of form handler or web service on the server side. Once this is done you can use AJAX to call the form handler or service and submit data that way.

您将需要在服务器端编写某种类型的表单处理程序或web服务。完成之后,可以使用AJAX调用表单处理程序或服务,并以这种方式提交数据。

Example- form.html -> submit -> formhandler.php -> content.xml

例子——形式。html ->提交->格式处理程序。php - > xml

#2


1  

Unless you are hacking a web server, you cannot write to a server from a client-side script written in javascript, java, actionscript, etc.

除非您正在攻击web服务器,否则您不能从用javascript、java、actionscript等编写的客户端脚本编写到服务器。

This is because basic web server security does not allow a script from a foreign source (your pc, for example) to write to files on the server. If it did, anyone with any small knowledge of web programming would be able to change the content of websites at will and without limitation.

这是因为基本的web服务器安全性不允许来自外部源的脚本(例如,您的pc)在服务器上写入文件。如果有的话,任何对网络编程稍有了解的人都可以随心所欲地改变网站的内容。

#1


5  

You will need to write some type of form handler or web service on the server side. Once this is done you can use AJAX to call the form handler or service and submit data that way.

您将需要在服务器端编写某种类型的表单处理程序或web服务。完成之后,可以使用AJAX调用表单处理程序或服务,并以这种方式提交数据。

Example- form.html -> submit -> formhandler.php -> content.xml

例子——形式。html ->提交->格式处理程序。php - > xml

#2


1  

Unless you are hacking a web server, you cannot write to a server from a client-side script written in javascript, java, actionscript, etc.

除非您正在攻击web服务器,否则您不能从用javascript、java、actionscript等编写的客户端脚本编写到服务器。

This is because basic web server security does not allow a script from a foreign source (your pc, for example) to write to files on the server. If it did, anyone with any small knowledge of web programming would be able to change the content of websites at will and without limitation.

这是因为基本的web服务器安全性不允许来自外部源的脚本(例如,您的pc)在服务器上写入文件。如果有的话,任何对网络编程稍有了解的人都可以随心所欲地改变网站的内容。