I have got this far with my coding:
success: function(data) {
$.each(data, function(item){
if (item=="") {
$(select_element).append($(document.createElement("option")).attr("value", (item)).html(data[item]));
} else {
$(select_element).append($(document.createElement("option")).attr("value",(item)).html(data[item]+" "));
}
‘item’ is an object with two attributes, description and id. Created select list works basically just find, but it returns the whole object now. Can I modify the createElement function so that id would be the returnable itemValue and description itemLabel? I’m newbie.
According to the given description of the
itemobject, this would be a better approach: