I have a flask route
@app.route('/another/<int:value>')
def another():
return 'another'
Using javascript, I'm trying to access the url for this route
using url_for
within jinja2 template braces
<script>
const v = 1;
const sample = "{{url_for('another', value=v)}}";
</script>
doing this raises an error jinja2.exceptions.UndefinedError: 'v' is undefined
.
I suspect v
is outside the scope of the jinja templates.
Is there a way around this?