0

我有一个表格。考虑我的表单中有一个按钮,我需要做的是在单击按钮时执行 ruby​​ 文件。实际上,我的 ruby​​ 文件将数据写入 html 文件。所以我还想在单击按钮时在框架中打开该文件。

4

1 回答 1

1

Make the button a submit button. Put it inside a <form>. Set the action of the form to a URL that your webserver maps onto the Ruby program. (You'll need to pick an interface that your program will conform to, e.g. CGI or Rack). Since you are playing with frames, also set the target attribute of the form.

Either change the output of the Ruby program so it outputs to the web server instead of a file, or set it to send an HTTP Redirect to the location you saved the file to.

于 2012-07-04T13:23:31.820 回答