how to populate a dropdown with the list elements in a flask app using jquery

我已经在烧瓶应用程序中定义了列表元素。代码如下:

@app.route('/', methods=['GET'])

def load_tack_id():

lst_tackid = ['13','108','89']

return render_template('index.html',lst_tackid = lst_tackid)

HTML代码如下。如果有任何错误,请纠正。

<select name="lst_tackid1"  method="GET" action="/">
 {% for lst_tackid1 in lst_tackid %}
 <option value= "{{lst_tackid1}}" SELECTED>{{lst_tackid1}}</option>"
 {% endfor %}
 </select>

回答 0