Jquery Mobile select refresh after ajax call not working

走远了吗. 提交于 2019-12-12 03:15:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!