Not displaying JSON data
Not displaying JSON data
kumarshb
Posts: 2Questions: 0Answers: 0
Hi,
I am trying to display the JSON data provided in the download folder and called 'package.json'. However, it displays a blank page. Below is a code. 'result' variable is equal to the JSON data provided and it is set correctly.
[code]
$(document).ready(function() {
$('#example').dataTable(result);
} );
[/code]
What am I doing wrong?
Thanks!
I am trying to display the JSON data provided in the download folder and called 'package.json'. However, it displays a blank page. Below is a code. 'result' variable is equal to the JSON data provided and it is set correctly.
[code]
$(document).ready(function() {
$('#example').dataTable(result);
} );
[/code]
What am I doing wrong?
Thanks!
This discussion has been closed.
Replies
Allan
[code]
var input="{ 'aaData': [SOME_JSON_DATA_FROM_OUTSIDE], 'aoColumns': [{ 'sTitle': 'Title', 'mDataProp': 'title' ]} ";
$(document).ready(function() {
$('#example').dataTable(input);
});
[/code]
I receive JSON data from a function and then create an "input" string with everything added. However, If I manually put inside dataTable() everything - then it works fine. How can I make so that I can just pass in the input received from the function?
Thanks.