const pathname = window.location.pathname; $(document).ready(function() { if ( pathname.includes('various_payment/list.php') || pathname.includes('loan/list.php') || pathname.includes('salaries/list.php') || pathname.includes('compta/sociales/list.php') || pathname.includes('compta/sociales/list.php') || pathname.includes('compta/bank/bankentries_list.php') || pathname.includes('compta/bank/list.php') || pathname.includes('compta/charges/index.php') || pathname.includes('expensereport/list.php') ) { const script = document.createElement("script"); script.src = window.location.origin + '/' +window.location.pathname.split("/")[1] + '/htdocs/custom/reportmp/js/jquery.table2excel.min.js'; script.addEventListener('load', () => { console.log(`has been loaded successfully!`); // use jQuery below }); document.head.appendChild(script); if($('.tagtable')[0]){ $('.tagtable').prepend(''); } else { $('.noborder').first().prepend(''); } } }); function exportTable(class_table){ $("."+class_table).table2excel({ filename: "reporte.xls" }); }