Question about display datable and have problem "Processing..." status alert
Question about display datable and have problem "Processing..." status alert
I have a problem when I attach datatables with python django framework, I only see "Processing..." status alert and I can not get my expected table from JSON format.
I post my code as follows:
<html>
<head>
{% load staticfiles %}
<style>
table, th {
border: 1px solid black;
}
.alt {
background: #dda;
}
td {
padding: 10px;
}
</style>
</head>
<body>
<!-- DataTables CSS -->
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.4/css/jquery.dataTables.css">
<!-- jQuery -->
<script type="text/javascript" charset="utf8" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<!-- DataTables -->
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Setup - add a text input to each footer cell
// DataTable
var table = $('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": "http://127.0.0.1:8000/reports/2014/ajax/json"
});
} );
</script>
{% block content %}
reports for {{ year }}
<ul>
<table id="example" class="display" width="100%" cellspacing="0">
<thead>
<tr>
<th>year </th>
<th>project </th>
<th>totaleore </th>
</tr>
</thead>
<tfoot>
<tr>
<th>year </th>
<th>project </th>
<th>totaleore </th>
</tr>
</tfoot>
</table>
</ul>
{% endblock %}
</body>
</html>