如何在href中传递参数?

时间:2017-12-07 06:47:21

标签: python html href tornado

我想在渲染页面时将href中的查询字符串值作为参数传递。我试过: class Room(tornado.web.RequestHandler): def get(self): nw=Test self.render("Room.html",nw=nw) 我使用龙卷风框架,python脚本是:

{{1}}

但是查询字符串没有取值“Test”,它给出了“/ room?nw =”作为URL.i.e.没有价值Test.Any帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

请尝试使用{{}},

<a href="/room?nw={{nw}}"><button type="button" class="btn btn-primary btn-xs">Add</button></a>

$replaceRoot