bootstrap-select没提供动态请求数据的方法,解决动态添加的问题
下载,例子,文档地址
http://silviomoreto.github.io/bootstrap-select/
请选择团购商品
                    
                        ${item.name}
                    
                
$(#goodsnames).selectpicker({});  //初始化
   var s = ;
   var timeout = ;
   $(.input-block-level).bind(propertychange input,function(event){   //添加input框事件
       s = $(this).val();
       cleartimeout(timeout);
       timeout = settimeout(function(){   //设置延后ajax请求
           var tempajax = ;
           $.ajax({
                 type : 'get',
                 url : '',
                 datetype : 'json',
                 data : goodsname=+s,
                 success: function(msg){
                     $.each(msg,function(i,n){
                        tempajax += +n.name+;
                     });
                     $(#goodsnames).empty();
                     $(#goodsnames).append(tempajax);    
                                         //更新内容刷新到相应的位置
                     $('#goodsnames').selectpicker('render');
                     $('#goodsnames').selectpicker('refresh');
                 }
            })
        },700);
        
   })
   
 
   