I have following code in my Flask template:
<div id="cell1"></div>
<script>
var id="0014";
cell1.innerHTML = '<a href={{url_for('static',filename='+id+'".txt")}}">'+id+'</a>';
</script>
I want the link to render to:
http://my_address/static/0014.txt
But I got this:
http://my_address/static/+id+.txt
How to make the js variable id in Flask url_for() function work?
Thanks for your help!
cell1.innerHTML = '<a href={{url_for("static", filename="'+id+'.txt")}}">'+id+'</a>';'<a href={{url_for("static",filename="'+id+'.txt")}}">'+id+'</a>'