我有一个使用flask/python框架的网页,也有一个引导按钮出现在网页上。现在我想在点击按钮/链接时传递一些值或参数,该怎么做呢?
在下面的代码中,Generatebill是我需要在单击时传递一些参数的按钮。
<div class="card text-white bg-info mb-3" style="max-width: 18rem;">
<div class="card-body">
<h5 class="card-title">Washinton laundries</h5>
<H5><p class="card-text">5 Kg </p></H5>
<H5><p class="card-text">Rate : 200 Rs</p></H5>
<a href="generatebill" class="btn btn-primary">Generatebill</a>
</div>
</div>发布于 2018-07-13 23:05:58
要通过view应用程序的视图传递参数,请执行以下操作:
在你的应用程序代码中定义参数:
@app.route("/path/<parameter>")
def view(parameter):
...(为了避免混淆:参数需要放在url中的<>括号中)
使用url_for()引用带有参数的视图:
<a href = "{{url_for('view'), parameter = 'parameter_content'}}"></a>https://stackoverflow.com/questions/51327859
复制相似问题