I have a list of开发者_如何学JAVA names, which I render at two different places in a HTML at one place it works fine, the other time it disappears.
names= ['a','b','c','d']
In the HTML code I am printing
{{names}}
this gives me the correct results. When I use the same string in a javascript it stops working but if I replace the variable by
['a','b','c','d']
then it works fine.
What do you mean 'in a javascript'? Is that in a template being rendered by Django, and if not how are you expecting it to be evaluated?
精彩评论