jquery - Bind array object list to the combobox -
i have array inside object.how can bind object combobox list .
combobox code:
<select name="select-native-5" id="cmbdty"></select>
i need bind id , ad field combobox
and array object;
here how object array,
jquery code:
$("#select-native-11").change(function () { var dd = $("#select-native-11").val(); $.ajax({ type: "post", url: "masasiparis.aspx/altmenugetir2", data: "{'p':'" + dd + "'}", datatype: "json", contenttype: "application/json; charset=utf-8", success: function (data) { alert(data.d); $.each(data.d, function (val, text) { alert(val); //i need put here }); }); }, error: function () { alert('hata');} }); });
you need reference of dropdownlist , add option in dropdown..
$("#select-native-11").change(function () { var dd = $("#select-native-11").val(); $.ajax({ type: "post", url: "masasiparis.aspx/altmenugetir2", data: "{'p':'" + dd + "'}", datatype: "json", contenttype: "application/json; charset=utf-8", success: function (data) { alert(data.d); var x = document.getelementbyid("myselect"); $.each(data.d, function (val, text) { alert(val); //i need put here //here dropdownid replace "select" var option = document.createelement("option"); option.text = text; option.value = val; x.add(option); }); }); }, error: function () { alert('hata');} }); });
Comments
Post a Comment