Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. def showpage():
  2. ...
  3. test = [1,2,3,4,5,6]
  4. return render_template("sample.html",test=test)
  5.  
  6. <script> var counts = {{test}}; </script>
  7.  
  8. def showpage():
  9. ...
  10. test = [1,2,3,4,5,6]
  11. test = json.dumps(test)
  12. return render_template("sample.html",test=test)
  13.  
  14. <script> var counts = JSON.parse("{{ test }}"); </script>
  15.  
  16. <script> var counts = {{ test|tojson }}; </script>
  17.  
  18. from flask import json
  19. return render_template("sample.html",test=json.dumps(test))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement