Hi,
Am new to this and just trying to submit dynamically populated select list on POST in MVC.
Have read this post but don't quite understand the details of the solution, or simply can't get it to work.
Here's my code:
$(document).ready(function () {
$("#SpecificID").hide();
$("#ObjectKindID").change(function () {
$.getJSON("/Client/GetSpecificClientDDL", { objID: $(this).val(), ajax: 'true' }, function (data) {
fillSelect($("#SpecificID"), data);
});
$("#SpecificID").show();
});
});
function fillSelect(selectList, data) {
selectList.html('');
$.each(data, function (index, optionData) {
selectList.append($('<option></option>').val(optionData.Value).html(optionData.Text));
});
}
$(document).submit(function() {
$("#SpecificID").find('option').attr('value', true);
});
Any help greatly appreciated - I expect (and hope) it is something stupidly simple...
Cheers.
Tim.