/ / Ako zobraziť dáta v datatable? javascript, jquery, datatables

Ako zobraziť dáta v datatable? javascript, jquery, datatables

Práve som začal s datatables a ja som pracoval s týmto príkladom z datatables docs, ale nemôžem získať dáta na zobrazenie. To je .html file:

<html>
<head>
<title>data</title>
<script   href="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script   href="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
<script type="text/javascript">
$(document).ready(function() {
$("#example").DataTable( {
"ajax": "arrays.txt"
} );
} );
</script>
</body>
</html>

a to je arrays.txt file:

    {
"data": [

[
"Tiger Nixon",
"System Architect",
"Edinburgh",
"5421",
"2011/04/25",
"$320,800"
]
]
}

Problém je v tom, že v datatebni nie sú zobrazené žiadne údaje.

odpovede:

0 pre odpoveď č. 1

Dovážíte datatable pred jquery.

od tej doby datatable vyžaduje jQuery, musíte načítať jQuery najprv.

Tiež by ste nikdy nemali importovať skripty na hlave. Dajte ju na koniec značky tela pred skriptami.