Monday, 12 August 2013

Value is not passed on javascript code in django

Value is not passed on javascript code in django

I am new to django and javascript both. And I am using highcharts for
displaying charts. My problem is at template file.
visualise.html contains
<script type="text/javascript">
var yname_agewise_total_call_duration = {{
yname.agewise_total_call_duration|safe }};
var yname_agewise_weekly_total_call_duration = {{
yname.agewise_weekly_total_call_duration|safe }};
</script>
I tested the value of yname.agewise_total_call_duration and
yname.agewise_weekly_total_call_duration in my html file it shows well.
But when I want to use that value yname_agewise_total_call_duration and
yname_agewise_weekly_total_call_duration in javascript file charts.js it
cannot show the values. I tried in charts.js as
alert(yname_agewise_total_call_duration);
the popup displays undefined.
What is the problem here ? How to solve it ?

No comments:

Post a Comment