I have list object passed from java to jsp. I want to iterate that array list in my javascript function.
For example, I have list called "arrayList" in java and I am getting that in my jsp as
<span id="valueList" style="display: none;">${arrayList}</span>
In javascript I tried fetching it as
$(document).ready(function () {
var ranges = new Array();
ranges.push($("#valueList").text());
$.each(array, function(i, item) {
console.log('val is '+item)
});
});
Here, in console, all the values are printing like [1,2,3,4,5,6] instead I want this to be printed separately.