imran bhatti

imran bhatti

  • NA
  • 28
  • 5.5k

javascript for cascading dropdownlist

Dec 23 2016 12:19 PM
using this code in mvc  
 
In view  
 
<script>
$(function () {
//Dropdownlist Selectedchange event
$("#ContId").change(function () {
$.get("/Home/GetStateById", { ID: $("ContID").Val() }, function (data) {
$("#St").empty();
$.each(data, function (index, row) {
$("#St").append("<option value='" + row.ID + "'>" +
row.Statename + "</option>");
// here we are adding option for States
});
})
});
});
</script>
 

 

 

 
but this is not working plz check this code there is an exception coming  at this line .
$.get("/Home/GetStateById", { ID: $("ContID").Val() }, function (data) {

Answers (5)