关于将java传过来的list动态遍历到html页面中

Ajax Success之后 动态加载实现后端传的list数据


    

    

                                

                                    

                                    

                                        

                                        

                                        

                                        

                                        

                                    

                                    

                                    

                                    

                                        

                                    

                                    

                                

0 1 2 3 ...

Js文件

/**

 * 自动加载规则信息,加载到01234..下面

 */

window.onload = function () {

    $.ajax({

        type: 'GET',

        url: "",

        contentType: "application/json;cherset=utf-8",

        dataType: "json",

        success: function (data)

                $('.node').empty()

            //取出后端传过来的list

                var list = data.data

                //list值进行便利

$.each(list, function (index, n) {

                        var rowTr = document.createElement('tr')

//找到htmltr节点

                        rowTr.className = "node"

                        var child = "" + list[index].0+ ""

                            + "" + list[index].1+ ""

                            + "" + list[index].2+ ""

                            + "" + list[index].3+ ""

                            + "" + list[index].4+ ""...等等

//将要展示的信息写入页面

rowTr.innerHTML = child

//将信息追加

                        $(".node").append(rowTr)

                    });

              }        

    });

}

你可能感兴趣的:(关于将java传过来的list动态遍历到html页面中)