Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

array javascript django

//https://stackoverflow.com/questions/739942/how-to-pass-an-array-in-django-to-a-template-and-use-it-with-javascript

//In Django:
from django.utils import simplejson
json_list = simplejson.dumps(YOUR_LIST)
//AND PASS "json_list" IN CONTEXT

//In JS:
var YOUR_JS_LIST = {{YOUR_LIST|safe}}; 
 
PREVIOUS NEXT
Tagged: #array #javascript #django
ADD COMMENT
Topic
Name
5+4 =