$.ajax ({ type: ' Post ', URL: "helper/ajax_search.php", data: {Models:decodeuricomponent (brands }, DataType: ' JSON ', success:function(data) { $ (' Select.multiselect '). empty ();
$ (' Select.multiselect '). Append ($ (' <option></option> ').text (' alle '). Val (' alle ') ); $.each (data, function(index, HTML) {$ (' select.multiselect '). Append ($ (' <option></option> ') ). Text (Html.name). Val (html.name)); }); $ ('. MultiSelect '). MultiSelect (' Rebuild ')}, Error:function(Error) {Console.log ("error:"); Console.log (Error); } });
<extend name= "public/base"/><block name= ' style ' ><style type= ' text/css ' > . sctext{width:700px; height:300px;} </style></block><block name= "Body" > <div class= "Main-title CF" > ); Highlight_subnav (' {: U (' Saveserver ')} '); Think.setvalue (' lua ', ' {: I (' Lua ')} '); $ (' #platform_type '). MultiSelect ({enablefiltering:true, Nonselectedtext: ' Please select platform type ' , Filterplaceholder: ' Search ' , Nselectedtext: ' Item is selected ' , Includeselectalloption:true , Selectalltext: ' Select All/deselect All ' , Allselectedtext: ' All platform types selected ' , maxheight : + }); $ (' #channel ' ). MultiSelect ({enablefiltering:true , Nonselectedtext: ' Please select Channel ' , Filterplaceholder: ' Search ' , Nselectedtext: ' Item is selected ' , Includeselectalloption:true , Selectalltext: ' Select All/deselect ' , Allselectedtext: ' All channels ' , maxheight:300 } are selected; $ ("#platform_type"). Bind ("Change", function () {var platform_type_ids=$ ("#platform_type"). Val ();//Get all platform types var ulr= ' {: U ('/admin/system/user/getchannel ')} ' ; $.ajax ({type: ' GET ' , URL:ULR, Data:{ids:platform_type_ IDS}, DataType: "JSON" , success:function (data) {
$ ("#channel Option[value]"). Remove ();
$ (data). Each (function $ (' #channel ').Append ($ (' <option></option> '). Text (v["Cn_name"]) . val (v["id"])); }); $ (' #channel '). MultiSelect (' Rebuild ')}}); }); </script> </block>
Bootstrap multiselect Set option