This may be a simple thing, but I am trying to capture the selected value from a drop down list on an JSP page and use the selected value as an argument to a method. I am able to use the onchange event in the select tag to call a java script function and capture the value but I am not sure how to send the value to the method. I think there is a way to do this via an ajax based call but I am not sure how to accomplish this. To be clear this code runs but I don't know how to pass the value to a method on the JSP page. Here is a sample of the test code I am using. Thank you.
<script>
function getSelected()
{
var selectedSource = document.getElementById("myselect").value;
console.log(selectedSource);
}
</script>
<select name="myselect" id="myselect" onchange="getSelected();">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>