Can't get dataTable to populate with Codeigniter and Ajax
<p>I have gone through several answers on SO as well as a few tutorials and the documentation on ajax/dataTables. My dataTable will still not populate with JSON data.</p>

<p>HTML:</p>

<pre><code>&lt;table id="table" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%"&gt;
        &lt;thead&gt;
            &lt;tr&gt;
                &lt;th&gt;Status&lt;/th&gt;
                &lt;th&gt;Student Name&lt;/th&gt;
                &lt;th&gt;Exam Name&lt;/th&gt;
                &lt;th&gt;School&lt;/th&gt;
                &lt;th colspan="2"&gt;Action&lt;/th&gt;
            &lt;/tr&gt;
        &lt;/thead&gt;

        &lt;tfoot&gt;
            &lt;th&gt;Status&lt;/th&gt;
            &lt;th&gt;Student Name&lt;/th&gt;
            &lt;th&gt;Exam Name&lt;/th&gt;
            &lt;th&gt;School&lt;/th&gt;
            &lt;th colspan="2"&gt;Action&lt;/th&gt;
        &lt;/tfoot&gt;
&lt;/table&gt;
</code></pre>

<p>Javascript:</p>

<pre><code>&lt;script type="text/javascript"&gt;

    $(document).ready(function() {

        // Datatables
        $('#table').DataTable({
            "url": "&lt;?php echo site_url('exams/ajax_list'); ?&gt;",
        });

    });

&lt;/script&gt;
</code></pre>

<p>ajax_list PHP function in Exams controller:</p>

<pre><code>public function ajax_list() {
    $list = $this-&gt;exam_model-&gt;get_datatables();
    $data = array();
    foreach ($list as $exam) {
        $row = array();
        $row[] = $exam-&gt;exam_status;
        $row[] = $exam-&gt;first_name . " " . $exam-&gt;last_name;
        $row[] = $exam-&gt;exam_name;
        $row[] = $exam-&gt;exam_school;

        $data[] = $row;
    }

    echo json_encode($data);
}
</code></pre>

<p>From what I can see when navigating to the method, the json_encode outputs correctly, but the dataTable is still empty.</p>

<p>Am I missing anything?</p>