In the template, define the javascript variable by writing it using TAL, for example:
<script type="text/javascript" tal:content="string:var MY_VAR=${view/myVar};"></script>
Now MY_VAR should be available within your external js if you call it after the line above ...
source
share