I have three dropdowns - Name, Specialization and Year of Study. A name is linked to only one specialization and year of study. When I select a Name, I want the other two dropdowns to autocomplete themselves from the database acording to what Name I selected. This is my ajax code so far. What am I doing wrong?
$("#name").on('change', function () {
GetStudentInfo();
});
function GetStudentInfo() {
var studId = $("#student").val();
if (studId) {
$.ajax({
url: '@Url.Action("GetStudentInfo", "StudentSituations")',
type: 'GET',
dataType: 'html',
data: { studId: studId },
success: function (data) {
$('#specialization').html(data);
$('#yearOfStudy').html(data);
}
});
return false;
}
};