Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

dynamic data fetching in datatable.net

$(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
                    });
                }
            });
        }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dynamic #data #fetching
ADD COMMENT
Topic
Name
2+7 =