location of data file
location of data file
niceseb
Posts: 2Questions: 2Answers: 0
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?
This discussion has been closed.
Answers
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