Created
June 12, 2019 17:37
-
-
Save Sirpyerre/4b8ce04db39df557ae331796eb119c23 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> | |
<meta http-equiv="content-type" content="text/html" /> | |
<title>DataTables mongoDB</title> | |
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"> | |
<script src="https://code.jquery.com/jquery-3.3.1.js"></script> | |
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script> | |
</head> | |
<body> | |
<p>you can use the file <b>datatables_mongodb.json</b> to load a colection example</p> | |
<table id="example" class="display" style="width:100%"> | |
<thead> | |
<tr> | |
<th>CAMPO 1</th> | |
<th>CAMPO 2</th> | |
<th>CAMPO 3</th> | |
<th>CAMPO 4</th> | |
<th>CAMPO 5</th> | |
</tr> | |
</thead> | |
</table> | |
<script> | |
$(document).ready(function() { | |
$('#example').DataTable( { | |
"processing": true, | |
"serverSide": true, | |
"ajax": { | |
"url": "./server_processing_mongodb.php", | |
"dataType": "jsonp", | |
}, | |
//indicate the names of fields how apeart in mongo collection | |
"columns": [ | |
{ "data": "campo_1"}, | |
{ "data": "campo_2"}, | |
{ "data": "campo_3"}, | |
{ "data": "campo_4"}, | |
{ "data": "campo_5"} | |
] | |
}); | |
} ); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment