Flask: how to change value of flask variable in html by click on link

Solution 1
from flask import request
var_name = request.args.get('var_name') = true

Solution 2

## you need flask's request module to access the request parameters
from flask import request

@app.route("/", methods=['GET', 'POST'])
def index():
   # this will be False by default, and True if the show_data url parameter is "true"
   show_data = request.args.get('show_data') == "true"

   # You can now use that value as any other in your template.
   # Also, I would suggest renaming "data"
   # To someone who reads your code, it looks like this variable contains
   # data, when it's actually just a boolean to show/hide the data.
   return render_template('index.html', data=show_data)