Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

django pass list to javascript

import json

mylistraw = [10,22,33,45]

mylist = json.dumps(mylistraw)

context = {''mylistjson': mylist}

now you can use your object in javascript.

var mylist = JSON.parse("{{mylistjson}}")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #pass #list #javascript
ADD COMMENT
Topic
Name
7+8 =