I sending a 2 array in my servlet but i don't know how to send my second array in javascript to my servlet I hope someone help me with this thank you.
<label for="pets">Choose your Vegetables:</label>
<select class="selectpicker" name="vegetables-selected" id="vege" multiple aria-label="size 3 select example">
<option value="Carrot">Carrot</option>
<option value="Broccoli">Broccoli</option>
<option value="Cabbage">Cabbage</option>
<option value="Cucumber">Cucumber</option>
<option value="Mushroom">Mushroom</option>
</select>
<label for="pets">Choose your pets:</label>
<select class="selectpicker" name="vegetables-selected" id="pets" multiple aria-label="size 3 select example">
<option value="dog">dog</option>
<option value="car">car</option>
<option value="snake">snake</option>
</select>
<Script>
document.getElementById('submit').onclick = function() {
var selected = [];
var selected2 = [];
for (var option of document.getElementById('vege').options
var option of document.getElementById('pets').options)
{
if (option.selected) {
selected.push(option.value);
}
}
document.location.href = 'output?selected='+ selected ;
}
</Script>
OUTPUT Broccoli,Cucumber,Potato null