@Html.DropDownList("Skills", null, htmlAttributes: new { @class = "form-control select2 MySkills", multiple = "multiple" }) <!-- or give id/class to select --> <select id="MySkills"> </select> |
function getSkills() { $.ajax({ url: '/Dropdown/GetSkills', type: "get", dataType: "json", contentType: "application/json", async:true, success: function (response) { $.each(response, function (i,x) { $('.MySkills').append('<option value=' + x.skill_id + '>' + x.skill_name + '</option>'); }); } }); } |
0 Comments