Int Array Django passed through context to JS not functioning
<p>I have an '<code>int Array</code>' e.g. <code>format [0,3,5,4,6]</code>, I have passed this through context. Now in my <code>HTML</code> page I have my <code>JavaScript/JQuery</code>... I thought it'd be as simple doing <code>{% for i in array %} i {% endfor %}</code> but this doesn't seem to be working for me to access the values from a loop. Can you pass a context to JavaScript from Django? how can I get around this problem? </p>

<p>edit the passing shouldn't be a problem if I access an index of the array by creating a variable in my view and passing that -> this will output fine in the script by simply doing <code>{{contextgivenname}}</code></p>

<p>edit2: if i do <code>{{arrayname}}</code> it will return the first value. But only the first value. So the only way to return all is to loop through it; which isn't working. </p>

<pre><code>anArray2 = [int(i['age']) for i in anArray]
{
'anArray2':anArray2
}
</code></pre>

<p>In JavaScript/Jquery when I'm trying to grab the data and use it {{anArray2}} = first value in it.. but if I loop via as mentioned above then nothing. </p>