DataTables

by sqiudward

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.css">
<script src="https://cdn.datatables.net/r/dt/dt-1.10.9/datatables.min.js"></script>
<h3>jQuery DataTables: Render cell content</h3>
<a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a><hr>

<table class="display" id="example">
    <thead>
        <tr>
            <th>Information</th>
            <th>Link</th>
        </tr>
    </thead>
</table>


<hr><a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a>

JavaScript

var responseObj = [
    [1, "http://www.microsoft.com"],[2, "	http://www.yahoo.com"],[3 ,"	http://www.google.com"]
];

$('#example').dataTable({
   "data": responseObj,
   "columns": [
      null, 
      { 
         
         "render": function(data, type, row, meta){
            if(type === 'display'){
                data = '<a href="' + data + '">' + data + '</a>';
            }
            
            return data;
         }
      } 
   ]
});