javascript - Passing variables from views.py into script.js -


i wondering whether or not possible pass variables render_to_response in views.py script.js,

render_to_response('appname/basic.html',{'var':somevariable}) 

i want access variable {{var}} outside of html page since script.js uses like:

function willhappen() {     var n = noty({         text: 'you're {{var}}!',         type: 'warning',         dismissqueue: false,         layout: 'center',         theme: 'defaulttheme'     })  } 

it works if put javascript html page wanted separate them since might using in lot of html pages.

a no solution writing code between <script></script> in html file

maybe in my_script.html:

<script>     function willhappen()     {         var n = noty({             text: 'you're {{var}}!',             type: 'warning',             dismissqueue: false,             layout: 'center',             theme: 'defaulttheme'         })      } </script> 

but, good?


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -