javascript - waiting GetJSON async to finish -
i have simple javascript code splistitems sharepoint using rest , populates dropdown list. want apply bootstap style on once dropdown populated. how can determine population of dropdown done/finsihed. can apply style on dropdown items.
function populatedropdown(dropdownid, splist) { var url = "http://devportal/formsrepository/_vti_bin/listdata.svc/" + splist; var dropdowncontrol = $('#' + dropdownid); $.getjson(url, function (data) { $.each(data.d.results, function (key, value) { dropdowncontrol.append( $('<option></option>').val(key).html(value.title) ); }); }); } //this lines work dropdown not populated yet $('.combobox').combobox();
your time , appreciated. cheers
why not place
$('.combobox').combobox();
after $.each loop?
Comments
Post a Comment