location of data file

location of data file

nicesebniceseb Posts: 2Questions: 2Answers: 0
edited July 2015 in Free community support

While following this example

http://www.datatables.net/examples/ajax/custom_data_flat.html
$(document).ready(function() {
    $('#example').dataTable( {
        "ajax": {
            "url": "data/objects_root_array.txt",
            "dataSrc": ""
        },
        "columns": [
            { "data": "name" },
            { "data": "position" },
            { "data": "office" },
            { "data": "extn" },
            { "data": "start_date" },
            { "data": "salary" }
        ]
    } );
} );

But I tried placing objects_root_array.txt in
1. same location as my javascript directory
2. top of project, created folder called data and placed objects_root_array.txt

but it always returns status code 404 file not found? Could someone clarify where to place this source data file?

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    You can place the data file anywhere you want. Just make sure that the ajax.url option points to that location.

    The example has it in a "data" directory which is at the same level as the example html file.

    Allan

This discussion has been closed.