How to fix datatables responsive doesn't work with ajax call

This post shows you how to fix datatables responsive doesn't work with ajax call

If you are using datatables plugin and getting a problem with responsive table with ajax call you can fix by adding to initialize your datatable.

"autoWidth": false

You need to stop this behaviour in bataTables is set the autoWidth parameter to false.

"responsive": true,
"autoWidth": false,

For example

$(document).ready(function() {
    table = $('#tbl').DataTable({
    responsive: true,
    "ajax": "table",
    "autoWidth": false,
    "columns": [
                { "data": "id" },
                { "data": "name"}          
                ]

    });

});