我在通过 ajax 加载的 json 文件中有大量数据行。
然后我创建了相当多的 html 代码,其中包含这样的每一行的一些数据。
var gl = $("#gameslist");
$.each(DATA.games, function(index, value) {
gl.append( '<div>... lots of html code here ... '+value.somedata+'</div>');
}
这似乎很慢,尤其是在移动 safari 浏览器上。是否有任何技巧或 jquery 插件来加快速度?
编辑:根据要求,这里是ajax调用:
$.ajax({
dataType: "json",
url: "../games.json"
})
.done(function(gamesjson){
DATA = gamesjson;
buildPage(); // this one is calling the above code
})
.fail(function(){
console.log("games.json error");
})
;