Dinamic file ajax
Dinamic file ajax
It is possible i make a function to return the name of the file that dataTable will read ? Because this works fine:
[code]
$(document).ready(function () {
$('#example').dataTable({
"sAjaxSource": 'json_source.txt'
});
});
[/code]
But i need a function to set the name of the file. I try this but doesn't work.
[code]
$(document).ready(function () {
$('#example').dataTable({
"sAjaxSource": function test(){return 'json_source.txt';}
});
});
[/code]
I'm starting so I don't know if it is possible or silly.
[code]
$(document).ready(function () {
$('#example').dataTable({
"sAjaxSource": 'json_source.txt'
});
});
[/code]
But i need a function to set the name of the file. I try this but doesn't work.
[code]
$(document).ready(function () {
$('#example').dataTable({
"sAjaxSource": function test(){return 'json_source.txt';}
});
});
[/code]
I'm starting so I don't know if it is possible or silly.
This discussion has been closed.
Replies
[code]
function test(){return 'json_source.txt';}
$(document).ready(function () {
$('#example').dataTable({
"sAjaxSource": test()
});
});
[/code]
Allan