javascript - Iterating through jquery json -
can have external json file can connect , show data manually when iterate data.length (which 100) shows 100th data.
here code
var url ="output.json"; $.getjson(url, function(data) { (var i=0;i <= data.length; i++) { $('#stage').html('<h4>' + data[i].title + '</h4>'); } });
i think it's because you're overwriting #stage element every iteration. appending each data element might work better:
var url ="output.json"; $.getjson(url, function(data) { (var i=0;i <= data.length; i++) { $('#stage').append('<h4>' + data[i].title + '</h4>'); } });
Comments
Post a Comment