64
rated 0 times
[
65]
[
1]
/ answers: 1 / hits: 15068
/ 8 Years ago, mon, april 18, 2016, 12:00:00
I know that we can use Django variable in templates(html files) with {{variable}}, but how can I use a variable Django in a Javascript file that included in the template?
For example here is my template.html:
<html>
<head>
<script src=/static/youtube.js></script>
...
how can I use variable {{user.get_username}} in youtube.js? not in template.html cause I did't wrote my script here...and when I use {{user.get_username}} in Javascript file youtube.js it caused an error invalid token { , but in the template it works fine.
Thanks a lot!
More From » python