user2517372
user2517372

Reputation:

Using Javascript variables in Python

While working on Tornado template, I know we can use/work with Python variables in HTML/Javascript using {{python_variable}}.

Similarly, is it possible to use Javascript variable in Python code, without passing to another file?

Upvotes: 1

Views: 212

Answers (1)

Phil H
Phil H

Reputation: 20151

No.

What you are doing in Tornado is constructing some HTML and javascript as text, ready to be sent to the user's browser to be interpreted. On the server, it is only text. You can put values from Python into the text, because the Python is running on the server. There is a clear and complete separation between what happens on the server (Tornado, python) and what happens later on the client (HTML, Javascript).

Upvotes: 3

Related Questions