ajax调用不起作用后,jQuery Mobile选择刷新 [英] Jquery Mobile select refresh after ajax call not working

查看:116
本文介绍了ajax调用不起作用后,jQuery Mobile选择刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可折叠内部的选择框.我正在尝试进行ajax调用,并从结果中动态添加选项.不幸的是,所选内容的刷新不起作用,现在仍显示选项.有指针吗?我正在使用jquery mobile 1.1.rc2

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");
});

推荐答案

您是否尝试过强制重建您的选择菜单?

//refresh and force rebuild
$('select').selectmenu('refresh', true);

这篇关于ajax调用不起作用后,jQuery Mobile选择刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆