Use freemarker variable in javascript / Jquery
2 answers
You can immediately use the FreeMarker JavaScript code. Here's a sample code where FreeMarker supplies Morris.js chart data. I think you will understand this idea.
new Morris.Area({
element: 'searchTrend',
resize: true,
data: [
<#list searchCount as sc>
{day: '${sc.date!?string("yyyy-MM-dd")}', count: ${sc.searches}} <#sep>,
</#list>
],
xkey: 'day',
ykeys: ['count'],
labels: ['Count'],
xLabelFormat: function (x) { return x.getDate(); }
});
0
source to share