问题
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