I have my javascript variable ass name array in this i have to print this selected values in to my jsp page.
This is my sample code (For Example):
var namesArray = [];
var checkBoxes = document.querySelectorAll('input[type=checkbox]');
for(var i = 0; i < checkBoxes.length; i++) {
checkBoxes[i].addEventListener('change', function() {
if(this.checked){
console.log(this.value);
namesArray.push(this.value);
console.log(namesArray);
}
});
}
tell how to get this var in my jsp and also to use in session......