我需要使用jquery在表中加载elem。这是代码:
在file.html中,表的代码是:
<table id="tabella_ban_email" class="table table-condensed table-responsive table-hover"></table>
并在script.js中代码为:
$(document).ready(function() {
var email_table=$('#tabella_ban_email');
if(email_table!=null && email_table!=undefined){
$.ajax({
url:'....',
success: function(data) {
data.split(',').forEach(function(email){
email_table.append('<tr><th>'+email+'</th><th><input type="button" name="'+email+'" value="X">');
});
}
});
}
});
该程序仅在我重新加载程序无法正常工作的页面时刷新页面。
答案 0 :(得分:0)
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
alert("document is ready");
});
$(window).load(function() {
// Executes when page is fully loaded
alert("window is loaded");
});
Use $(window).load ... it might work in your scenario