ajax取得list填充列表

$.ajax({
                type : "post",
                async : true,
                url : "/statistic/getRankPersonVo",
                data :{dept_id:dept_id,cmp_id:cmp_id,week_num:week_num},
                dataType : "json",        //返回数据形式为json
                success : function(data) {
                    var str = "";
                    for(var i=0;i<data.length;i++){
                        str += "<tr>" +
                                "<td>" + data[i].name + "</td>" +
                                "<td>" + data[i].degree + "</td>" +
                                "<td>" + data[i].rank + "</td>" +
                                "<td>" + data[i].up_down + "</td>" +
                                "</tr>";
                    }
                    console.log(str);
                    $("#t_body").append(str);
                },
                error : function(errorMsg) {

                }
            });

表单列表html:

<table  style="height:400px;margin-bottom: 0px;" class="table table-bordered">
                                    <thead>
                                    <tr>
                                        <th>姓名</th>
                                        <th>维护次数</th>
                                        <th>名次</th>
                                        <th>上升/下降</th>
                                    </tr>
                                    </thead>
                                    <tbody id="t_body">

                                    </tbody>
                                </table>

猜你喜欢

转载自blog.csdn.net/qq_31293575/article/details/81272421
今日推荐