码迷,mamicode.com
首页 > Web开发 > 详细

jquery ajax异步加载table的方法

时间:2015-01-22 17:28:59      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:

 

//显示详细信息
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

 

jquery ajax异步加载table的方法

标签:

原文地址:http://www.cnblogs.com/dekevin/p/4241789.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!