Please be easy with me, I am trying to solve but could not hence asking for help. I have 2 combo boxes named as first combo box and second combo box in auto.jsp.
I am getting value in a div in auto.jsp by onchange event of first combo box, but the value, i am getting is not populating in the second combo box rather it is being displayed like plain text inside the id combo2
. How to populate this data with in that second combo box. I tried a lot but could not do it , any ideas please?
auto.jsp
<script type="text/javascript">
$(document).ready(function() {
$("#combo1").change(function() {
$.get('combo.jsp', { combo1Val : $(this).val() }, function(responseData) {
$("#combo2").replaceWith(responseData);
});
});
});
</script>
<body>
<select id="combo1" name="combo1Val">// After onchange event of this combo box, second box is disappeared and i am getting value 1, how can i display this one inside the option value of second combo box?
<option value="">select</option>
<option value="1">One</option>//
</select>
<select id="combo2" name="combo2">
<option value="">select</option>
<option value="2">Two</option>
</select>
</body>
combo.jsp
<%
String combo1Val=request.getParameter("comboVal");
out.println(combo1Val);// displaying value 1 in auto.jsp in id combo2
%>
Any ideas please?