How to use in where clause when populating datatables

How to use in where clause when populating datatables

andiejeandieje Posts: 8Questions: 2Answers: 0
edited May 2014 in DataTables 1.10

Hello

I have seen this code for trying to send customer_id as a where clause to my datatables server side page

```javascript
var customer_id = "<?php echo $customer_id; ?>";
var table = $('#branchesdt').DataTable( {
"processing": true,
"serverSide": true,
"sPaginationType": "full_numbers",
"columns": [
{ "data": "branch_name" },
{ "data": "branch_email" },
{ "data": "tel" },
{ "data": "fax" },
{ "data": "address1" },
{ "data": "address2" },
{ "data": "town" },
{ "data": "city" },
{ "data": "county" },
{ "data": "postcode" },
{ "data": "country_name" },
{"data": null,
"defaultContent": "<button>Click!</button>"
}

         ],
         "sAjaxSource": "DataTables/branches_dt.php",
        "fnServerData": function ( sSource, aoData) {
            /* Add some data to send to the source, and send as 'POST' */
            aoData.push( {"name": "customer_id", "value": customer_id} );
            $.ajax( {
                "dataType": 'json',
                "type": "GET",
                "url": sSource,
                "cache": false,
                "data": aoData,
                "success": function(json) {
                            /* Do whatever additional processing you want on the callback,
                             then tell DataTables */
                      fnCallback(json);

                }     

                } );
             }

} 

   );

```

It doesnt work the table just shows processing

Thanks in advance for your help

Answers

This discussion has been closed.