DataTable Bug
by FirstBug
HTML
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css">
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<table id="example" class="display" cellspacing="0" width="100%">
</table>
JavaScript
$(document).ready(function () {
var table= $('#example').DataTable({
"columns": [{
'title': 'userId',
'data': 'userId'
}, {
'title': 'Title',
'data': 'title'
}],
'ajax': function (data, callback) {
$.ajax({
'type': 'GET',
'url': 'http://jsonplaceholder.typicode.com/posts',
'cache': false,
'contentType': 'application/json;',
'dataType': 'json',
'data': data,
'success': function (jSon) {
callback( {
data: jSon
});
},
'error': function () {
callback([]);
}
});
}
});
});
// table does not exist
var tableInfo = table.page.info();
console.log(tableInfo );