access spring model attribute in javascript with variable -
i added attribute 'workplacegroups' spring model, list. later try accsess on 1 object in list given index. access works if .get(0)
use variable int .get(i)
but error.
can tell me why got error or how can use variable int i? answers.
<script th:inline="javascript"> function printtest(i){ var test = [[${workplacegroups.get(0).getid()}]]; //works var test2 = [[${workplacegroups.get(i).getid()}]]; //doesn't work } </script>
Comments
Post a Comment