javascript - How to add option/ ListItem to dropdownlist dynamically -
I need to dynamically create my DDL, I get use of JSON from DSB (I any I do not get the problem ) but could not show my data in my DDL ... I tried three different ways, nothing is changing. What am I doing?
// HTML
and ATP: dropdown list id = "product ddl" runat = "server" css class = "ddl" & gt; & Lt; / Asp: dropdownlists & gt;
// javascript
function creatDDL (data) {var obj = $ .parseJSON (data.Data); (Var i = 0; i & lt; obj.length; i ++) {$ ("# Product DDL") for Attachments ("& lt; Option & gt;" + obj [i] .ID + "'-'" + + obj [i] .name + "& lt; / option & gt;"); $ ("# ProductDDL"). Attachments ("& lt; Option & gt;" + obj [i] .ID + "'-'" + obj [i] .name + "& lt; / Options & gt;"); $ ("# ProductDDL") .andend ($ ("
Comments
Post a Comment