【问题标题】:How to pass an argument in href?如何在href中传递参数?
【发布时间】:2018-05-21 05:05:24
【问题描述】:

我想在渲染页面时将 href 中的查询字符串值作为参数传递。我尝试过: <a href="/room?nw=" + nw ><button type="button" class="btn btn-primary btn-xs">Add</button></a> 我使用了tornado框架,python脚本是:

class Room(tornado.web.RequestHandler):
    def get(self):
        nw=Test
        self.render("Room.html",nw=nw)  

但查询字符串不采用值“Test”它给出“/room?nw=”作为 URL.i.e.没有值 Test。任何帮助将不胜感激。

【问题讨论】:

    标签: python html href tornado


    【解决方案1】:

    请尝试使用 {{}},

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

    http://www.tornadoweb.org/en/stable/guide/templates.html

    【讨论】:

      猜你喜欢
      • 2019-04-21
      • 2022-01-23
      • 2016-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-17
      • 2013-12-09
      相关资源
      最近更新 更多