Handle ampersand in a URL in Flask
You want to build the URL from the view instead, using url_for
:
<td><a> href="{{ url_for('on_plot', label=stats[0]) }}">{{stats[0]}} </a></td>
The url_for()
method will build a query string for you and escape the ampersand appropriately.