Another rookie JSON question

Another rookie JSON question

atlmapperatlmapper Posts: 3Questions: 0Answers: 0
edited December 2012 in General
I've made a solid search session on JSON input and I'm still coming up short. I've validated my JSON in JSONLINT validator and it is approved. The format of the standard output is: [code] [{"Title":"Item", "Title":"Item", "Title":"Item"},{"Title":"Item", "Title":"Item", "Title":"Item"}] [/code]

In my understanding, I need to parse the JSON and format it into the aaData format to be useable and this is where the problem starts. I'm currently taking the JSON and pulling the fields needed, via the $.ajax call once all the data is called I'm taking the string combining it and converting it into an array. But the formatting isn't perfect aaData format, (which I'm assuming is the problem and I can't figure out how make it proper), i'm working on js nesting to nest the arrays inside an array and give it a name "aaData".

The Table is reporting as null which leads me to be believe its a formatting issue, but as a whole I feel like I'm missing an easier critical step to bring in the JSON. If I'm missing something and this setup is rubbish please let me know I'm not married to this code and my only goal is fill the table with the required data.

All the variables listed below are globally defined at the beginning of the JS sheet.....

Here is my JS:
[code]
$.ajax({
url: uMtbls,
dataType: 'json',
success: function (jMtbl) {
$.each(jMtbl, function (i, item) {
mAll = jMtbl[i];
mOwn = jMtbl[i].OrigOwner;
mPub = jMtbl[i].PublicationTblNm;
mTbl = jMtbl[i].TableId;
mMig = jMtbl[i].MigrationFreq;
mGTYPE = jMtbl[i].GTYPE;
exec();

});

oTable = $('#dtManaged').dataTable({
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"aaData": jReform,
"aoColumns": [
{ "sName": mOwn, "sTitle": "Original Owner", "sWidth": "10%" },
{ "sName": mPub, "sTitle": "Table Name" },
{ "sName": mTbl, "sTitle": "ID" },
{ "sName": mMig, "sTitle": "Migration Frequency" },
{ "sName": mGTYPE, "sTitle": "Oracle Gtype" },
],
"sPaginationType": "full_numbers",
"iDisplayLength": 25,
"aLengthMenu": [
[25, 50, 100, -1],
[25, 50, 100, "All"]
]
});

}
});

function exec() {
jBld = mOwn + "," + mPub + "," + mTbl + "," + mMig + "," + mGTYPE;
//console.debug("[" + mOwn + "," + mTbl + "]");
jReform = jBld.split(",");
// console.debug(jReform);
}
}
[/code]

Replies

This discussion has been closed.