Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82404

Ajax Example with JSON

$
0
0

I am trying to follow the AJAX example, though my data is all JSON

Data:

{ "personOne": { "username": "personOne", "systemA": "true", "systemB": "true" }, "personTwo": { "username": "personTwo", "systemA": "true", "systemC": "true" } }

My HTML is very simple:

    <script>
        $(document).ready(function() {
            $('#hubUserTable').DataTable( {
                "dom": '<"top"lif>rt<"bottom"Bp><"clear">',
                "buttons": [
                    'copy', 'csv', 'excel', 'print'
                ],
                "scrollX": true,
                "pagingType": "numbers",
                "processing": true,
                        
                "nowrap": true,
                "ajax": 'datatable_access.php'
            } );
        } );

    </script>

However, I dont get any data, and I do get a error

TypeError: e[i] is undefined[Learn More] jquery.dataTables.min.js:65:437 

Any help please? There should be 4 columns. (however, notice each person does not have all columns).

If it helps, my data within the 'datatable_access.php' is an array as $myData[[]], that I do a echo json_encode on to output, so I can put it in a different format if thats easier.


Viewing all articles
Browse latest Browse all 82404


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>