multiselect下拉选项动态赋值

来源:互联网 发布:淘宝号出售 编辑:程序博客网 时间:2024/05/22 09:47
    var site = new Array();    $.each(data, function(index, values) {        //循环将data数据的结构重新调整为下面这样的:[{label:xxx,value:id}]        // laebl相当于option的文字,value则是option的value,结构不能错        site.push({            label : values.site_name,            value : values.id        });    });    $("#site_id").multiselect('dataprovider',site);