Uncaught TypeError: Cannot read property 'length' of undefined
Uncaught TypeError: Cannot read property 'length' of undefined
jupix
Posts: 15Questions: 4Answers: 0
Hi all,
my JSON:
My Code:
<script>
$(document).ready(function() {
$('#example').DataTable( {
"ajax": './getCalendarData.php',
"dataSrc":'',
"columns": [
{ "data": "id" },
{ "data": "typ_id" },
{ "data": "day" },
{ "data": "users_id" },
{ "data": "text_short" },
{ "data": "text_long" }
]
} );
} );
</script>
The error:
datatables.min.js:89 Uncaught TypeError: Cannot read property 'length' of undefined
at datatables.min.js:89
at i (datatables.min.js:76)
at Object.success (datatables.min.js:76)
at i (datatables.min.js:14)
at Object.fireWith [as resolveWith] (datatables.min.js:14)
at A (datatables.min.js:16)
at XMLHttpRequest.<anonymous> (datatables.min.js:16)
I realy have no idea. please help.
thanks
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
ajax.dataSrc
should be in theajax
object. See this example.Allan
Thx!!!
<script>
$(document).ready(function() {
$('#example').DataTable( {
"ajax": {
"url": "./getCalendarData.php",
"dataSrc": ""
},
"columns": [
{ "data": "id" },
{ "data": "typ_id" },
{ "data": "day" },
{ "data": "users_id" },
{ "data": "text_short" },
{ "data": "text_long" }
]
} );
} );
</script>