感谢那些帮助过我的人!
我的问题是js事件绑定到原始表。因此,我所要做的就是添加javascript,使表打开并接近ajax成功声明的结尾。
/* When the date range is changed, update the table
*/
$('#reportrange').on('apply.daterangepicker', function(ev, picker) {
var begin = picker.startDate.format('MM/DD/YYYY');
var stop = picker.endDate.format('MM/DD/YYYY');
// AJAX call to our php function which creates the table
$.ajax({
url: 'php/jstranslator.php',
type: 'post',
data: {'action': 'table', 'start': begin, 'stop': stop},
success:function(result){
document.getElementById("replace").innerHTML = result;
$(function(){
$(".fold-table tr.view").on("click", function(){
$(this).toggleClass("open").next(".fold").toggleClass("open");
});
});
},
error: function(xhr, desc, err) {
console.log(xhr);
console.log("Details: " + desc + "\nError:" + err);
}
});
});