jquery - Adding options to select dynamically -


i have pulled data backend using ajax/json, , trying append data select box using jquery. data appended select box properly, shown on page when put alert("some text").

here code:

var comp_select = jquery("select[class='xf-depselect-selector depselect-fragment']").get(3);  alert("some text");  (var = 0; < data.length; i++) {    jquery(comp_select).append(new option(data[i]["component_name"], data[i]["component_name"])); } 

without seeing more of code, sounds race condition. code append items inside success callback ajax call, or function called after calling ajax method? loop through 'data' suggest callback wouldn't able tell sure snippet


Popular posts from this blog