jquery ajax异步加载table的方法

 

//显示详细信息
function showInfo(actionId, type) {
    $.post("Sys_Ajax/Sys_EmployInfo.ashx", { "type": "select", "actionId": actionId, "type2": type }, function (data, status) {
        if (status == "success") {
            var employs = $.parseJSON(data);
 
            $("#EmoplyList").empty(); //清空列表
            var head = "<tr class=‘topTrStyle‘><td>姓名</td><td>编号</td><td>归属公司</td><td>直属部门</td><td>职位</td><td>角色</td><td>操作一</td><td>操作二</td></tr>";
            $("#EmoplyList").append(head);
            //加载列表
            for (var i = 0; i < employs.length; i++) {
                var tr = "<tr style=‘background-color: #E9F2F7; font-size: 10pt; height: 25px‘>";
//                tr += "<td><a href=‘Employ_Edit.aspx?type=show&actionId=" + employs[i].Id + "&actionId2=" + actionId + "&type2=" + type + "&showTitle=查看用户信息‘>" + employs[i].Name + "</a></td>";
                tr += "<td><a id=‘aInfo[" + i + "]‘ href=‘javascript: void(0)‘ onclick=‘javascript: editEmploy(\"show\",\"" + employs[i].Id + "\",\"" + actionId + "\",\"" + type + "\",\"查看用户信息\");return false;‘>" + employs[i].Name + "</a></td>";
                tr += "<td>" + employs[i].Code + "</td>";
                tr += "<td>" + employs[i].Corp + "</td>"
                tr += "<td>" + employs[i].Dept + "</td>";
                tr += "<td>" + employs[i].Post + "</td>";
                tr += "<td>" + employs[i].Role + "</td>";
                tr += "<td><a id=‘aDel[" + i + "]‘ href=‘javascript: void(0)‘ onclick=‘javascript: del(" + employs[i].Id + ");return false;‘>删除</a></td>";
                tr += "<td><a id=‘aEdit[" + i + "]‘ href=‘javascript: void(0)‘ onclick=‘javascript: editEmploy(\"edit\",\"" + employs[i].Id + "\",\"" + actionId + "\",\"" + type + "\",\"编辑用户信息\");return false;‘>编辑</a></td>";
                tr += "</tr>";
 
                $("#EmoplyList").append($(tr));
            } //end for employs
        } //end if status
    });    //end post
} //end showInfo

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。