Instead of doing it that way, try something like this:
var table = $("");
if (table){
table.append($("").append($("| ").text("City")));
$.each(data, function(i, item){
table.append($(" |
").append($("| ").text(item.city)));
});
table.appendTo($("#all_locations"));
}
Here's another way that's closer to how you're currently doing it:
$("#all_locations""#all_locations").append("| City | ");
$.each(data, function(i, item){
$('#all_locations').append("");
$('#all_locations').append("| "" | | " + item.city + " | "td> ");
$('#all_locations').append(""});
}
$("#all_locations tr").wrapAll("");
|