What is the path for the ajax file for server side processing

What is the path for the ajax file for server side processing

andiejeandieje Posts: 8Questions: 2Answers: 0

Hello

I am trying to do some server side processing and the ajax code isn't loaded. The file structure i have is /tables_inc/scripts/ids-objects.php and /tables_inc/scripts/ssp.class.php

The data table sits in a file called ids.php in the root. This is the javascript for it

var table = $('#example').DataTable( {
    "processing": true,
    "serverSide": true,
    "ajax": "tables_inc/scripts/ids-objects.php",
    "columns": [
        { "data": "first_name" },
        { "data": "last_name" },
        { "data": "position" },
        { "data": "office" },
        { "data": "start_date" },
         {"data": null,
                "defaultContent": "<button>Click!</button>"
                     } 

         ]
} );

The ids-objects isnt being found. I've tried

"ajax": "/tables_inc/scripts/ids-objects.php",
"ajax": "tables_inc/scripts/ids-objects.php",
"ajax": "./tables_inc/scripts/ids-objects.php",

The datatable is always empty and the ids-objects isn't reached as I've put a die statement in there

Please can you advise where i,m going wrong

thanks

Answers

  • andiejeandieje Posts: 8Questions: 2Answers: 0

    Note if i call the ids-objects file directly I get this output so perhaps this is the problem

    Notice: Undefined index: columns in C:\xampp\htdocs\cpe\tables_inc\scripts\ssp.class.php on line 159

    Notice: Undefined index: draw in C:\xampp\htdocs\cpe\tables_inc\scripts\ssp.class.php on line 245
    {"draw":0,"recordsTotal":11,"recordsFiltered":11,"data":[{lots of rows........

  • andiejeandieje Posts: 8Questions: 2Answers: 0

    Hello

    In case this helps anyone in the future I was using an old version of datatables which was saying that my table was empty all the time. It wasnt that the data source could not be accessed.

    When i upgraded to new version of DT i got an ajax error when it couldnt find the ajax file. This then helped me find the way :)

This discussion has been closed.