Send a dropdown selection to modal window

Hi community.

My problem is that I send the value of a dropdown to a modal window. If anyone can help I would be very grateful

this will give you an idea make sure you change the markup




<select name="fieldname" id="fieldname">

	<option value="1">Value 1</option>

	<option value="2">Value 2</option>

</select>


<div id="myModal">

	// header div

	<div class="modal-body">

		<div id="selectedValue"></div>

	</div>

	// footer div

</div>


<script>

$("#fieldname").on('change', function() {

	$("#selectedBody").html($(this).val());

});

</script>

Hi alirz23.

I need to capture value from the dropdown sending a controller , it processes the data and the response burden in the modal window, I tried using JS, but I can not make it work