0
我在HTML页面中有一个DIV容器,我使用jquery.load()函数动态加载其他HTML页面。在其中一个页面上,我需要在该页面加载之前/之前从数据库填充表格。我该如何调用一个在该页面加载DIV之后执行的JavaScript函数。如何在动态加载的DIV中填充html表格
这是动态加载的 “headquarters.html” 页:
<div class="row">
<div class="col-md-10" >
<table class="table table-bordered table-hover" id="tbl_hqlist">
<tr>
<th> HQ Code</th>
<th> Headquarter Name</th>
</tr>
</table>
</div>
</div>
我使用jquery.load()函数类似下面加载该页面:
function fn_headquarters(){
$('#bodyContent').load("../html/headquarters.html");
headquarterManagement();
return;
}
function headquarterManagement(){
$.ajax({
url:"../bin/manage_hq.php",
data:{ 'procAction': 1},
method: 'POST',
dataType: 'JSON',
success: function(proc_msg){
// get data and populate the table using jquery.each() & jquery.append() functions
},
error: function(xhr){
console.log(xhr.responseText);
}
})
return;
}
此代码更新失败“tbl_hqlist”。
感谢..现在就像一个魅力... :) –