开发者

List variable containing string not getting rendered in Django Template

开发者 https://www.devze.com 2022-12-17 23:12 出处:网络
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.

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消