I have an HTML table with several columns in the below template. The last column of the table has a button. The code is as follows.
index.html
<table id="deployment_table" class="table table-striped">
<thead>
<tr>
{% for col in colnames %}
<th>{{ col }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for record in records %}
<tr>
{% for col in colnames %}
<td>{{ record[col] }}</td>
{% endfor %}
<td class="td-actions text-right">
<a href=ct_edit ><input type="submit" name="edit_btn" value="update"rel="tooltip" class="btn btn-info"></a>
</input>
</td>
</tr>
{% endfor %}
</tbody>
</table>
When the user click the button of a specific row, I need to pass the value of the first column of the selected row to a Flask function and load another HTML page using this data.
Below is the flask back end function.
@app.route('/ct_edit')
def ct_edit():
print('ct_edit')
# the value of the first column of the selected row => ID
# do something with the ID value and get a result
return render_template('ct_edit.html', result=result)
So far I'm unable to make this work. Can I please have any advice for this?