1

I am new to jQuery and ftl. The process I'm trying to achieve is to assign a checkbox value to a ftl variable. In my example the variable selectedValues contains the necessary value which is to be copied into an ftl variable. Passing jQuery values to an ftl variable is possible.

Here is the example code I tried with:

<script type="text/javascript">
$(document).ready(function () 
{
var selectedValues="";
$checkedCheckboxes = $("input:checkbox[name=numbers]:checked");
$checkedCheckboxes.each(function () {
selectedValues +=  $(this).val() +",";
});
alert(selectedValues);
});
</script>

    <#assign checkboxvalue=" ? "/>
4

1 回答 1

2

这是不可能的,我很害怕。Freemarker 模板在服务器端进行评估。Java Script 在客户端进行评估。

于 2013-01-11T11:01:49.397 回答