Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Schleid Alex
1.7k
361
32.3k
How to fill dependent dropdownlist with jquery
Apr 15 2021 7:35 PM
I am trying to acheive this simple thing I have class dropdownlist that upon selection will fill another student dropdownlist, I am using jquery, below is my code
$(
'#ddClass'
).on(
'change'
, function () {
var ClassID = $(
'#ddlClass'
).val()
$.ajax({
url:
'StudentList'
,
type:
'GET'
,
contentType:
'apllication/html; charset=utf-8'
,
data: { ID: ClassID},
dataType:
'html'
,
success: function (result) {
$.each(result, function(index, row){
$(
'#ddlStudent).append("<option value = '
"+row.StudentID+
" '> "
+row.StudentName+"</option>
}
}
})
Please help me find out why it is not working.
Thank you!
Reply
Answers (
3
)
asp.net core filtering not working properly
Custom search to filter different records in asp.net mvc