Created
May 25, 2018 14:53
-
-
Save bishoyAtif/7004bae39b057cf26ddbe03f130b4fcd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.css"/> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css"> | |
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css"> | |
<title>Posts</title> | |
</head> | |
<body> | |
<div class="container" style="margin-top: 50px"> | |
<table id="demo_table" class="table table-striped table-bordered" style="width:100%"> | |
<thead> | |
<tr> | |
<th>#</th> | |
<th>Title</th> | |
<th>User Name</th> | |
<th>Comments Number</th> | |
<th>Actions</th> | |
</tr> | |
</thead> | |
</table> | |
</div> | |
<script type="text/javascript"> | |
function htmlDecode(data){ | |
var txt=document.createElement('textarea'); | |
txt.innerHTML=data; | |
return txt.value | |
} | |
</script> | |
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script> | |
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.js"></script> | |
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready( function () { | |
$('#demo_table').DataTable({ | |
"processing": true, | |
"serverSide": true, | |
"ajax": '{{ route('ajax.posts.index') }}', | |
"columns": [ | |
{ data: "id" }, | |
{ data: "title" }, | |
{ data: "user_name" }, | |
{ data: "comments_num" }, | |
{ data: "actions", | |
render: function(data){ | |
return htmlDecode(data); | |
} | |
} | |
] | |
}); | |
} ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment