I have write down a view:
def Country_names(request):
c_list = []
for c_name in c_names:
c_list.append(c_name)
return render(request, 'DATAPLO/Country_list.html', {'c_list':c_list})
This view transfers a list/array to template further in my html template it try to convert this python variable into javascript array variable.
<script>
//variable defined to store "c_list" array
var c_names = {{c_list}}
//try to access array items like this
c_names[0]
</script>
But his method is not working in my case how can I do this, I have explore dfew similar threads on the web but nothing is working in my case.
thanks
scriptshould be inside the HTML, not in a separate.jsfile. Works pretty well if it's inside the HTML page.