Table is "Loading..." infinite

Table is "Loading..." infinite

GehmasseGehmasse Posts: 7Questions: 1Answers: 0

My table in index.html is loading all the time ans does ot display the data from 'table.php' that i created by the php function json_encode().

table.php:
[{"id":"2","0":"2","vorname":"Max","1":"Max","nachname":"Mustermann","2":"Mustermann","strasse-hsnr":"Musterstra\u00dfe 5","3":"Musterstra\u00dfe 5","plz":"12345","4":"12345","ort":"Musterstadt","5":"Musterstadt","tel-1":"0123 456789","6":"0123 456789","tel-2":"456 789321","7":"456 789321","e-mail":"max@muster.mann","8":"max@muster.mann","bemerkungen":"Bemerkungen:\r\nMax ist ein netter Kunde","9":"Bemerkungen:\r\nMax ist ein netter Kunde"}]

index.html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
$('#personen').DataTable({
ajax: 'table.php',
columns: [
{ data: 'id' },
{ data: 'vorname' },
{ data: 'nachname' },
{ data: 'ort' }
]
});
});
</script>
<table id="personen" class="display">
<thead>
<tr>
<th>ID</th>
<th>Vorname</th>
<th>Nachname</th>
<th>Ort</th>
</tr>
</thead>
<tfoot>
<tr>
<th>ID</th>
<th>Vorname</th>
<th>Nachname</th>
<th>Ort</th>
</tr>
</tfoot>
</table>
</body>
</html>

Sorry for the all German words but i want to show you the original code :wink:
Maybe you can help me detecting the problem :smile:

Answers

Sign In or Register to comment.