我想删除div中的现有表,并创建一个新的每一次页面接收json编码数据。关闭json数据填充表
我在关闭表格时遇到问题?
HTML:
<div id="tblContent"></div>
JQ:
var um_getallusers='<table class="table-hover" id="um"><thead><tr><th class="col-md-1">ID</th><th class="col-md-4">Name</th><th class="col-md-4">username</th><th class="col-md-3"></th></tr></thead><tbody>';
$.getJSON('php/um_getallusers.php',function(dta){
$("#tblContent").remove(); //del table
$.each(dta,function(index,item){
um_getallusers+='<tr><td>'+item.id+'</td><td>'+item.name+'</td><td>'+item.username+'</td></tr>';
});
var um_getallusers='</tbody></table></table>'; // this is my problem
$('#um').html(um_getallusers);
});
@mitogh:我不这么认为。 – Fergoso 2014-10-09 04:36:25