Datatables Ajax Test

by Siddhanathaswami

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
<body>

  <div id="container">



    <table id="example" class="display" cellspacing="0" width="100%">
      <thead>
        <tr>
          <th>EMB</th>
          <th>FirstName</th>
        </tr>
      </thead>
    </table>
  </div>

</body>

JavaScript

//Doesn't work:
//$(document).ready(function() {
//  $('#example').DataTable({
//    "ajax": "http://www.hheonline.org/test/example.json"

//  });
//});

$(document).ready(function() {
  $('#example').DataTable({
    ajax: {
      url: 'http://www.hheonline.org/test/realdata.json',
      dataSrc: ''
    },
 //   data: data,
    columns: [
    {data: 'EMB'}, 
    {data: 'FirstName'}
    ]

  });
});