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

jQuery ajax大数据量each输出 list

时间:2015-11-13 12:57:24      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:

<script>
var tbodystr = "";
$.ajax({
                type: "get",
                url: "gettable.ashx",
                cache: false,
                datatype: "json",
                success: function(msg) {
                    $.each(msg, function(i) {
                        tbodystr = "<tr>";
                        tbodystr += "<td>" + msg[i]._0 + "</td>";
                        tbodystr += "<td>" + msg[i]._1 + "</td>";
                        tbodystr += "<td>" + msg[i]._2 + "</td>";
                        tbodystr += "</tr>";
                        $("#tbmain tbody").append(tbodystr);
                    });
                }
            });

</script>

gettable.ashx文件
httpcontext.current.response.write(json.getjsondata(ds, keyfileds.tostring()));

大类的数据,就优化下看看

success: function(msg) {
   var tbodystr = [];
   $.each(msg, function(i) {
      tbodystr.push("<tr>");
      tbodystr.push("<td>" + msg[i]._0 + "</td>");
      tbodystr.push("<td>" + msg[i]._1 + "</td>");
      tbodystr.push("<td>" + msg[i]._2 + "</td>");
      tbodystr.push("</tr>");      
   });
   $("#tbmain tbody").append(tbodystr.join(""));
}

jQuery ajax大数据量each输出 list

标签:

原文地址:http://www.cnblogs.com/chuanqimessi/p/4961750.html

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