hi,
it's because JavaScript has no idea about your ${bars}. it belongs to
python. what you should do is instantiating a JS array and then
looping over your ${bars} and appending its content to JS array.
the following might give you an idea
<script type="text/javascript">
var dataset = new Array();
{% for bar in bars %}
dataset.push(bar);
{% endfor %}
</script>
On Feb 27, 2:11 am, vrs762 <[email protected]> wrote:
> Hi,
>
> I have my controller returning an array of floats called arrVals to a kid
> template file.
>
> In the template file within the javascript code block, when I do a <?python
> print arrVals ?>, I get the right output, which is [0.2, 0.4, 0.6, 0.8]
>
> However, when I try assigning arrVals to a javascript variable like this:
>
> var dataset[];
> dataset = "${bars}";
> alert(dataset);
>
> The alert message block shows 0.20.40.60.8, and not as an array.
>
> How would I fix this?
>
> Thanks.
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.