使用烧瓶重定向到其他HTML文件
我有2个HTML文件,一个我在开始时使用的一个文件,我想要的是,在用户单击按钮和发布请求中后,它应该更改为另一个HTML页面。
我当前的代码(一部分):
...
@app.route('/test', methods=['POST'])
def test():
output = request.get_json()
print(output)
render_template('secondform.html', static_folder='static')
...
但问题是这是行不通的……
我将如何使它在检测到发布请求后,它将切换到全新的HTML页面。
任何帮助都赞赏。
I have 2 HTML files, one I am using in the beginning, and what I want is that after the user clicks a button and a POST request comes into the code, it should change to another HTML page.
My current code (part of it):
...
@app.route('/test', methods=['POST'])
def test():
output = request.get_json()
print(output)
render_template('secondform.html', static_folder='static')
...
But the problem is that this doesn't work...
How would I make it that it would that after a POST request has been detected, it would switch to a completely new HTML page.
Any help appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要实现此目标,只需检查 request.method 相应地,
get
和发布
:To achieve this simply check the request.method and add logic accordingly for
GET
andPOST
: