$(document).ready(function() {
get_employees('all');
});
function get_employees(emp_type)
{
$.ajax({
url: '../ajax_request.php',
type: "POST",
data: {
action: "admin_get_all_employees",
type: emp_type
},
success: function(response) {
var response = jQuery.parseJSON(response);
// $('#example').destroy(); tried this but haven’t worked
$('#example').dataTable({
destroy: true,
aaData: response.data
});
}
});
}