DEV Community

loading...

How to set a jinja variable to Javascript?

whataluckyguy profile image Lalit Kumar ・1 min read

This article will answer the question “how to set a jinja variable to javascript?”. Before answering this question, the important question is that if it is possible to set a jinja variable to javascript.

Python is the server language and jinja is a templating engine for python. Jinja makes it easy to generate HTML without writing it directly. Javascript is our browser’s scripting language, so it will be running on the client's browser once the HTML has been generated and served.

And it is not possible to use javascript to set jinja variables. And it is not possible because there are no jinja variables in the rendered HTML sent to the client.

Now the question is that is there a way so we can set a jinja variable to javascript.

Yes! There is a way.
Read more

Discussion (0)

pic
Editor guide