如何使用jQuery datatable和PHP进行简单的CSV导出功能

I want to export the visible data in datatable to CSV format. Here is my code,I have added following code

var $table=$('#example').dataTable
                ( {
                    "bFilter": false,           
                    "processing": true,
                    "serverSide": true,
                    "bDestroy": true,
                    "bJQueryUI": true,

                      "sDom": 'T<"clear">lfrtip',
                      "oTableTools": {
                             "aButtons":    [ "csv", "xls", "pdf" ]
                                },

                    "ajax": {
                        'type': 'POST',
                        'url': 'getResult.php',
                        'data': {
                                    formName:'afscpMcn',
                                    action:'search',
                                    mcn_no: document.getElementById('mcn_no').value,
                                    cust_nm:document.getElementById('cust_name').value,
                                    emp_id: document.getElementById('employ_name').value
                                }
                            }

                 });

DataTables has no native functionality for saving data to CSV. The page you're looking at is for an extension called TableTools. That extension uses a SWF file to perform its functionality:

"tableTools": {
    "sSwfPath": "/swf/copy_csv_xls_pdf.swf"
}

which is missing from your code.