views:

59

answers:

1

Hi,

I have a list of 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.

+1  A: 

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?

Daniel Roseman
document.getElementById('leaderboard_swf').callSWF('asMethod',{{final_score_list}},{{final_level}},{{final_challengeswon}},{{final_bronze}},{{final_silver}},{{final_gold}},{{names}});If I do not put the line names in the end it works. Otherwise it does not. But if I replace {{names}} by its value it works.
Fahim Akhter
That did not answer the question even slightly. Where is this code? What sort of file? How is it being rendered?
Daniel Roseman
The javascript code is in an HTML. The python code is rendered in a django template. I tried rendering a string into javascscript. Having the same problem, the string gets rendered in the HTML not the javascript
Fahim Akhter
You are not being clear. Is the javascript in a Django template or not?
Daniel Roseman