title: jQuery Datatable with NodeJS & MySql
body: <p>I want to display the values in my Datatable. I opened my chrome dev tool and go to network tab, XHR and  <strong>the problem is, the response is an HTML document</strong></p>
  
  <p><strong><em>server side code:</em></strong></p>
  
  <pre class="lang-js prettyprint-override"><code>router.get('/agents', (req, res) =&gt; {
    let dB = req.dB;
    let sql = 'SELECT * FROM tbl_users WHERE role_id = 3';
  
    dB.query(sql, (err, agents) =&gt; {
      if (err) throw err;
      const data = { agents };
      console.log(data);
  
      res.render('dashboard/agents', data);
    });
  });
  </code></pre>
  
  <p><strong><em>client side script:</em></strong>
  </p>
  
  <pre><code>$('#agent_table').DataTable( {
    processing: true,
    serverSide: true,
    ajax: {
      url: '/administrator/agents',
      type: 'GET',
      dataSrc: 'agents'
    },
    columns: [
      { data: 'user_id' },
      { data: 'checked' },
      { data: 'first_name' },
      { data: 'middle_name' },
      { data: 'role_id' },
    ]
  } );
  </code></pre>
  
  <p><strong><em>client side htmlt:</em></strong>
  </p>
  
  <pre><code>&lt;table id="agent_table" class="table table-striped table-bordered dt-responsive nowrap"
              cellspacing="0" width="100%"&gt;
              &lt;thead&gt;
                &lt;tr&gt;
                  &lt;th&gt;User ID&lt;/th&gt;
                  &lt;th&gt;
                    &lt;div class="checkbox checkbox-success select_all"&gt;
                      &lt;input class="styled" type="checkbox" id="check_all"&gt;
                      &lt;label for="check_all" class="check_all_label"&gt;All&lt;/label&gt;
                    &lt;/div&gt;
                  &lt;/th&gt;
                  &lt;th&gt;First Name&lt;/th&gt;
                  &lt;th&gt;Middle Name&lt;/th&gt;
                  &lt;th&gt;Last Name&lt;/th&gt;
                  &lt;th&gt;Role&lt;/th&gt;
                &lt;/tr&gt;
              &lt;/thead&gt;
            &lt;/table&gt;
  </code></pre>
  
  <p><strong><em>console log in server</em></strong></p>
  
  <blockquote>
    <p>{ agents:    [ RowDataPacket {
           user_id: 6,
           first_name: 'Pamela',
           middle_name: 'Pearl',
           last_name: 'Sabes',
           email: 'test@gmail.com',
           password: '1bd07c9db7ae63c02f2ee75471727f58',
           mobile_number: '09503713607',
           invite_code: '',
           birthday: 'Nov 29, 2005',
           gender: 'Female',
           address: '',
           image: null,
           contact_person: '',
           contact_person_number: '',
           role_id: 3,
           longitude: '',
           latitude: '',
           medical_info: '',
           is_verified: 1,
           is_deleted: 0,
           created_at: '0000-00-00 00:00:00',
           updated_at: 2018-05-30T20:42:43.000Z } ] }</p>
  </blockquote>