python主页面,网页使用CGI Python重定向到主页面

As my first web app I developed a very simple survey. Random questions are being asked from the user anytime the page refreshes. The answer is sent to a cgi script using post to save the answers to the database.

However, when the user presses the submit button it automatically goes to the page which is responsible for processing the data and since it doesn't have any output it is a blank page. Now if the user wants to answer another question they have to press the "back" in the browser and refresh the page so a new question pops up. I don't want this.

I want it in a way that when the users pressed submit, the answers go automatically to the processing script and the page refreshes itself with a new question or at least after processing it redirects to the main survey page with a new question.

解决方案

It's much simpler than it sounds. The CGI script that receives the POST must simply produce the following output:

Status: 303 See other

Location: http://lalala.com/themainpage

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值