Skip to content

Commit

Permalink
ASSIGNJS
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Mar 27, 2017
1 parent 3a058fe commit f288f41
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sources/29-web2py-english/05.markmin
Original file line number Diff line number Diff line change
Expand Up @@ -1915,5 +1915,15 @@ var someURL = "{{=URL('default', 'myfunction')}}";
<script src="{{=URL('static', 'js/my.js')}}"></script>
``:code

or equivalently using the web2py ``ASSIGNJS`` helper:

``<script>
{{=ASSIGNJS(someVar = T('some phrase to be translated'),
someURL = URL('default', 'myfunction'))}};
</script>
<script src="{{=URL('static', 'js/my.js')}}"></script>
``:code

then in "my.js", ``someVar`` and ``someURL`` can be used as normal javascript variables.


0 comments on commit f288f41

Please sign in to comment.