layui 动态绑定下拉框

后台方法:

public JsonResu1t GetSelect{
var  result =new Dictionary().OrderBy (e=>e.Name).ToList(); 
result ["data"]=list; 
return Json (result, JsonRequestBehavior. AllowGet) ;  

 

前台:

JS :

$.get ('GetSelect', function (res) { 
layui.each (res. data, function (index, item) ( 
$ ("#Category_select"). append ('')
});
 
form. render ();//渲染layui select样式
});

 

Select  绑定

 

 

你可能感兴趣的:(Layui)