运行 CGI 应用程序而不从 HTML 重定向

发布于 2024-07-11 18:26:38 字数 582 浏览 6 评论 0原文

我有一个由 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

与风相奔跑 2024-07-18 18:26:39

您可以从 CGI 脚本发送 302 状态代码,这会将用户的浏览器重定向到 /index.html

基本上,让 CGI 脚本输出以下内容:

HTTP/1.1 302 Found
Location: /index.html

 

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:

HTTP/1.1 302 Found
Location: /index.html

 
无戏配角 2024-07-18 18:26:39

你基本上是在问“我如何使用 AJAX”。 我建议使用图书馆。 在 JQuery 中,它看起来像:

$.ajax({
   type: "POST",
   url:  "/cgi-bin/Lib.exe",
   data: "foo=bar&spoo=fleem",
   success: function(html){
      $("#results").append(html);
   }
});

you're basically asking "how do I use AJAX". I'd recommend using a library. In JQuery it would look something like:

$.ajax({
   type: "POST",
   url:  "/cgi-bin/Lib.exe",
   data: "foo=bar&spoo=fleem",
   success: function(html){
      $("#results").append(html);
   }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文