Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assigning free marker list to a Javascript Array

Is it possible to assign a freemarker list to a Javascript Array? Does any other technique exist to achieve the same?

Suppose I have the following code

<#list messages.thread.messages.topic as message>
<div id="subject">${posts.subject}</div>
<div id="teaser">${posts.teaser}</div>
<div id="body">${message.body}</div>
</#list>

function script(){
   //I want to access the free marker list message here
}
like image 642
rozar Avatar asked Dec 27 '11 09:12

rozar


1 Answers

Yes it is possible

var arr=[<#list messages.thread.messages.topic as message>${message.body},</#list>]
like image 145
rozar Avatar answered Oct 16 '22 23:10

rozar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!