Reputation: 11
I need some help in Ajax, based on the drop down value selected, list of its corresponding values are to be displayed in the form of check boxes and the user can select multiple check boxes.
Upvotes: 1
Views: 1268
Reputation: 9266
On the Internet, there are tons of Ajax tutorial that teaches you to do such things. Why don't you do some Google search first lol?
Anyway, it can be something like this:
<select id="dropdown" onchange="makeAjaxCall()">
<option value="">Select something</option>
<option value="option1">Option 1</option>
</select>
<div id="checkList"></div>
function makeAjaxCall()
{
$("#checkList").html('');
if ($("#dropdown").val() != "") {
optionChosen = $("#dropdown").val();
$.ajax({
type: "GET",
url: "SomePage",
data: {
dropdown: optionChosen
},
success: function(response) {
$(response).find('something').each(function() {
//generate the check boxes and put in the div.checkList
});
},
dataType: "xml"
});
}
}
Upvotes: 1