> $.getJSON("url", function(json){ > $(json).each(function(){ > row = $("#table").append("<tr>"); > $(row).append("<td>").html(json.cell1.value); > $(row).append("<td>").html(json.cell2.value); > }); > }); > > something like this?
This is a very, very, very... very slow way to append var html = '<tbody>' $(json).each(function(){ html += '<tr><td>' + json.cell1.value + '</td><td>' + json.cell2.value + '</td></tr>'; }); html += '</tbody>'; $('#table').append(html); Is about 20 times faster. You can bump it up another couple of times faster by sticking all of the strings in an array and using .join before inserting them in the html, but you lose so much legibility of code that I only do that when doing thousands of string concatenations on large strings. As for Maruicio's question...Looks like you solved it. The link works fine in FF. A few other tips about the code: 1) do the .append outside of the loop by using the loop to create one long string for about 10x speed increase. 2) stick the one long string into one DOM node like a tbody for about a 6x speed increase. 3) instead of obj['name'] use obj.name They both work, but the first makes it look like a hash when you are really using properties of an object. Cheers, Josh Powell