how to use redirect(url_for('index')) with id to reload the index.html with specific section

爷,独闯天下 提交于 2019-12-13 21:21:22

问题


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'))

I wanted to reopen my index.html with section which id=content I tried - url_for('index',id="content") but not working.

Which way should I modify my redirect(url_for.... line to achieve this? Please help.


回答1:


You can pass your id as _anchor:

url_for('index', _anchor="content")

See url_for's docs for more information.



来源:https://stackoverflow.com/questions/17483125/how-to-use-redirecturl-forindex-with-id-to-reload-the-index-html-with-spec

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!