I have a javascript function that is trying to dynamically insert an anchor tag into a webpage, the href attr of which being a url for a flask route. This flask route accepts an argument username
. I want to set username
to the value of a javascript variable.
I have tried using template literals:
let username = 'user1';
let href = `{{ url_for("some.route", username=${username}) }}`
$("#elem").append('<a href=' + href + '></a>');
which throws a jinja2.exceptions.TemplateSyntaxError: unexpected char '$'
error.
I've also tried string concatenation:
let username = 'user1';
let href = '{{ url_for("some.route", username=' + username + ')}}'
$("#elem").append('<a href=' + href + '></a>');
which results in the literal string + username +
being passed to the route.
Any ideas on how to do this?
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am creating a table with sticky columns using css position: stickyI want to style the columns differently when they are "stuck"
I have a scenario in which a user like his post, and it will fills a heart, coolIf user 2 likes the same post, user 1 heart becomes unfilled
My parent module async loads jquery3, in way that jquery3 is scoped to my parent moduleIn the parent I also load other submodules that use jquery