I am trying to fill up a table using JSON data
Here's what I am thinking
$.ajax({
dataType: "json",
url: "music.json"
})
.done(function(gamesjson){
DATA = gamesjson;
buildTable(DATA ); // this one is calling the above code
})
.fail(function(){
console.log("music.json error");
})
;
function buildTable(DATA){
var gl = $("#gl");
$.each(DATA.music, function(index, value) {
// code to populate table
??
}
$("#gl").append(gl);
}
What do I write in buildTable()? Also if my json contains 1000 rows, what's the best way to build table?
Please give an example and explanation. Thanks
http://jsfiddle.net/9u4zR/1/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…