I want to get the value of the selected item in dropdown in some variable and use it in my code. I want to use this data for another dropdown next to this list:
<html>
<head>
<title>Home Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
</head>
<body>
<button id="mybtn">Emp Name</button>
<div>
<select id="output">
<script>
$('#mybtn').click(function () {
$.getJSON('empData', function (data) {
$("select#output > option").remove();
$.each(data, function (key, value) {
$("#output").append('<option>' + value['empId'] + " " + value['empName'] +'</option>');
});
});
});
</script>
</select>
</div>
</body>
</html>