Cant get sAjaxSource and sAjaxDataProp to start working

Cant get sAjaxSource and sAjaxDataProp to start working

dewildedewilde Posts: 9Questions: 0Answers: 0
edited April 2014 in General
Hi,

I have a problem with getting the data from a sAjaxSource. i Use a website as a sAjaxSource
I have trying the sAjaxDataProp nested properties but that doesnt work.

Can someone help me out.

Here is my code for the datatable:
[code]
$(document).ready(function() {
$('.dataTable').dataTable( {
"sDom": 'frtip',
"sPaginationType": "bootstrap",
"oLanguage": {
"sZeroRecords": "No Data Found - Sorry!",
},
"iDisplayLength": 5,
"bProcessing": true,
"sAjaxSource": "http://example.com/datafetcher/test/example",
"sAjaxDataProp": "example-com.test.data"
} );
} );
[/code]

Here is the array i use:
I have more data in my array, this is just a example
[code]
{
"example-com": [{
"test": {
"label": "test",
"data": [
[20, 45],
[21, 45],
[22, 45]
]
}
[/code]

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    There is no `test` property of `example-com` is the problem. Its an array. So you could use: `example-com.0.text.data` to get the first element in that array.

    Allan
  • dewildedewilde Posts: 9Questions: 0Answers: 0
    edited April 2014
    Tnx that work, i have another question about this.
    How do i get the data example-com in the second row of the table?

    [code]



    20
    example-com
    45



    [/code]
This discussion has been closed.