如何使用带有id的redirect(url_for('index'))重新加载带有特定部分的index.html [英] how to use redirect(url_for('index')) with id to reload the index.html with specific section
问题描述
我的index.html文件包含指向同一页面上某个位置/部分的链接;其中之一就是内容". 当我在.py中使用以下行发送电子邮件后, 返回重定向(url_for('index'))
My index.html file contains Links to a location/sections on the same page; one of which is 'content'. After sending email when I am using below line in my .py - return redirect(url_for('index'))
我想用id = content的部分重新打开index.html 我试过了-url_for('index',id ="content")但没有用.
I wanted to reopen my index.html with section which id=content I tried - url_for('index',id="content") but not working.
我应该以哪种方式修改redirect(url_for ....行来实现这一目标? 请帮忙.
Which way should I modify my redirect(url_for.... line to achieve this? Please help.
推荐答案
您可以将id
传递为_anchor
:
url_for('index', _anchor="content")
有关更多信息,请参见 url_for
的文档.
See url_for
's docs for more information.
这篇关于如何使用带有id的redirect(url_for('index'))重新加载带有特定部分的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!