问题
I have a select box which is inside a collapsible. I am trying to make an ajax call and add options dynamically from the result. Unfortunately the refresh on the select doesn't work and options are still now shown. any pointers? I am using jquery mobile 1.1.rc2
$.getJSON(myurl, function(data) {
$.each(data, function(key,value) {
myDropDown.append($("<option />").val(key).text(value));
});
myDropDown.selectmenu("refresh");
});
回答1:
Have you tried forcing the rebuild of your selectmenu?
//refresh and force rebuild
$('select').selectmenu('refresh', true);
来源:https://stackoverflow.com/questions/10177815/jquery-mobile-select-refresh-after-ajax-call-not-working