Here is what I have:
for (i = 0; i < data.length; i++) {
$("#myDropDownLisTId").find('tbody')
.append($('<option>').attr('value', data[i].id).attr('name', data[i].name)
);
}
But the dropdown list always remains the same. Why is this not working? the data variable has beautiful values. Also, I would like before the for loop to empty the dropdown list/ How to do it?
Here is my drop down list in the view:
<%= Html.DropDownList("myDropDownLisTId")%>