I am trying to put array from JSTL for loop to an array in JS
<c:forEach items="${defaultWishList}" var="eachItem">
${eachItem.getItem().getId()};
${eachItem.getItem().getName()};
</c:forEach>
and put each row in :
var ar = new Array();
Now I tried the following way which is not working
<script type="text/javascript">
var ar = new Array();
var aaa="";
var bbb="";
<c:forEach items="${defaultWishList}" var="eachItem">
aaa = ""+${eachItem.getItem().getId()};
bbb = ""+${eachItem.getItem().getName()};
ar.push({
F : aaa,
L : bbb
});
</c:forEach>
</script>
Is it possible to do this. If yes then how??