select2 存取 备份

  $.ajax({
            url:'aeoEmployeeApplyController.do?queryStaff',
            type:'GET',
            dataType:'JSON',
            delay: 250,
            cache: true,
            success: function(d){    
                var data = d;
                var pcname = new Array();
                for(var i = 0; i < data.length; i++){
                    var pcnameObj = {}; 
                    pcnameObj.id = data[i].id;
                    pcnameObj.text = data[i].empName;
                    pcname.push(pcnameObj);                     
                    
                }    

                $("#operatorCode").select2({
                    data: pcname,
                    placeholder:'请选择人员',//默认文字提示
                    language: "zh-CN",//汉化
            multiple: true, //多选
allowClear: true//允许清空 }); $("#operatorCode").change(function() { var temp = $("#operatorCode").select2("data"); var text = temp[0].text; $('#operator').val(text); }); } });

 

posted @ 2021-02-05 17:33  薛柏梁  阅读(50)  评论(0编辑  收藏  举报