In a flask app I pass the length of a dataframe to the html
return render_template("causes.html",vid=vid,dflength=dflength)
the html gets the value of dflength inside a script (named myscript below) without any problem.
<script>
var dflength = {{ dflength|safe }};
...
</script>
However when I try to move the above script from the html to a separate js file the double curly braces give an error Uncaught SyntaxError: Unexpected token {
<script src="/static/javascript/myscript.js" type="text/javascript"></script>
The last attempt I tried adding parentheses ({{ dflength|safe }})
without any luck... any ideas as to why this works inline but not in a separate js file? Jslint just tells me Expected an identifier and instead saw '{'.