Last active
August 29, 2015 14:10
-
-
Save OliPelz/7d46ac01e888b6fd2829 to your computer and use it in GitHub Desktop.
server-side datatable GET request
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
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=us-ascii"> | |
<meta name="viewport" content="width=device-width,initial-scale=1"> | |
<link rel="stylesheet" href="//cdn.datatables.net/1.10.1/css/jquery.dataTables.css" /> | |
</head> | |
<body> | |
<table id="example" class="display" width="100%" cellspacing="0"> | |
<thead> | |
<tr> | |
<th>Phenotype Name</th> | |
<th>Organism</th> | |
</tr> | |
</thead> | |
<tfoot> | |
<tr> | |
<th>phenoName</th> | |
<th>organismName</th> | |
</tr> | |
</tfoot> | |
</table> | |
<script data-require="[email protected]" data-semver="1.10.1" src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<script src="//cdn.datatables.net/1.10.1/js/jquery.dataTables.js"></script> | |
<script type="text/javascript" data-require="[email protected]" data-semver="1.2.15" src="http://code.angularjs.org/1.2.15/angular.js"></script> | |
<script type="text/javascript" src="https://rawgithub.com/l-lin/angular-datatables/dev/dist/angular-datatables.min.js"></script> | |
<script> | |
$(document).ready(function() { | |
$('#example').dataTable( { | |
"bServerSide": true, | |
"fnServerData": function (sSource, aoData, fnCallback) { | |
var myData = JSON.stringify(aoData); | |
$.ajax({ | |
"dataType": 'json', | |
"contentType" : "application/json;charset=utf-8", | |
"type": "GET", | |
"url": "http://localhost:3000/ajax/phenotypes/withOrg/like/datatables/", | |
"data": myData, | |
"success": fnCallback, | |
"error": function () { | |
alert('have some problem'); | |
} | |
}); | |
} | |
} ); | |
} ); | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment