运行 CGI 应用程序而不从 HTML 重定向
我有一个由 cgi 应用程序填充的 html 页面。 现在,当我通过表单对 html 页面进行更改时,
<form action="/cgi-bin/Lib.exe" method=POST name="checks" ID="Form2">
它会将我从
http://localhost/index.html
到
http://localhost/cgi-bin/Lib.exe CGI 输出一些我放入其中的调试行。 然后我必须手动返回索引以查看它的更新。
当html表单向cgi应用程序发送请求时,CGi应用程序对数据库进行更新并重写索引html。 如何留在索引页面并查看其更新? (我正在运行轻量级 GoAhead Web 服务器、C 语言的 CGI 以及 html、JS)
谢谢。
I have an html page populated from a cgi app. Right now when I make a change on my html page through a form
<form action="/cgi-bin/Lib.exe" method=POST name="checks" ID="Form2">
It takes me from
http://localhost/index.html
to
http://localhost/cgi-bin/Lib.exe
where the CGI outputs some debug lines I put in there. I then have to manually go back to the index to see it updated.
When the html form sends a request to the cgi application, the CGi application makes the update to the database and re-writes the index html. How do I stay on the index page and see it updated? (I am running the light weight GoAhead web server, CGI in C, and html,JS)
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以从 CGI 脚本发送 302 状态代码,这会将用户的浏览器重定向到
/index.html
。基本上,让 CGI 脚本输出以下内容:
You can send a 302 status code from the CGI script, which will redirect the user's browser to
/index.html
.Basically, make the CGI script spit this out:
你基本上是在问“我如何使用 AJAX”。 我建议使用图书馆。 在 JQuery 中,它看起来像:
you're basically asking "how do I use AJAX". I'd recommend using a library. In JQuery it would look something like: