首页 > 程序开发 > web前端 > HTML/CSS >

通过ajax请求后台返回两个List拼装table

2017-03-31

通过ajax请求后台返回两个List拼装table:两个List组装成一个对象。

通过ajax请求后台返回两个List拼装table:两个List组装成一个对象。

语法

$(selector).each(function(index,element))
$.ajax({
            url:APP_PATH+"/templates/yn/userauth/checkAddResult.do",
            async: false,
            type:'post',
            dataType:'json',
            success:function(datas){
                var viewiUserList =  datas.viewiUserList;
                var viewResAuthzList = datas.viewResAuthzList;
                $.each(viewiUserList, function (n, obj) { 
                    var errorMess = obj.errorMessage==undefined?"":obj.errorMessage;
                    var trs = "";
                    trs += "" + obj.name + " " + obj.userId+ " " + obj.gender+ " " + obj.email+ "" + obj.idCardNum+ " " + obj.mobile+ " " + obj.userType+ " " + obj.userGroup+ " " + errorMess+ "";  
                    userTbody += trs; 
                    userTbody.replace("undefined","");
                 });

                $.each(viewResAuthzList, function (n, obj) { 
                    var errorMess = obj.errorMessage==undefined?"":obj.errorMessage;
                    var resRr = "";
                    resRr += "" + obj.userName + " " + obj.mobile+ " " + obj.resName+ " " + obj.astType+ "" + obj.resIP+ " " + obj.accountId+ " " + obj.jkUserId+ " " + obj.approverMobile+ " " + errorMess+ "";
                    userAuthzTbody +=resRr;  
                    userAuthzTbody.replace("undefined","");
                });

                $("#userList").html(userTbody);
                $("#userauthzList").html(userAuthzTbody);
            } 
        });
相关文章
最新文章
热点推荐