layui form里的select元素动态赋值无效

需要重新更新渲染下select下拉框

使用 form.render(‘select‘);

                      $.ajax({
                            url:url,
                            contentType:"application/json;charset=UTF-8",
                            type:‘GET‘,
                            async:false,
                            success: function (res) {

                                let data=res.results,
                                    str1=`<option value="">请选择资产</option>`;
                                data.map((item,index)=>{
                                    console.log(item)
                                    str1+=`<option value="${item.id}">${item.name}</option>`
                                })
                                $("#quiz2").html(str1);
                                console.log(data);
                                form.render(‘select‘);
                            },
                            beforeSend:function(xhr){//
                                xhr.setRequestHeader("Authorization",iotAuthorization);
                                xhr.setRequestHeader("X-SiteWhere-Tenant",iotTenant);
                            }
                        });

 

layui form里的select元素动态赋值无效

上一篇:x的平方根


下一篇:Win7 安装bundle