JSON not being processed when received?
JSON not being processed when received?
I'm trying to get a list of courses from the server, and at the end of each row, show a link to view details of each course. Since the code I use on the server is most likely going to be reused outside of the table, I don't think I should be hardcoding the link into the server script. Therefore, I'm trying to setup another column with the JSON that I received from the $.ajax() - however, it doesn't seem to be processing it at all. Any ideas?
[code]$('#courses').dataTable({
"sPaginationType": "full_numbers",
"bServerSide": false,
"bJQueryUI": true,
"bProcessing": true,
"bVisible": true,
"sAjaxSource": 'GetAvailableCourses',
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some data to send to the source, and send as 'POST' */
aoData.push( { "client" : "jquery" } );
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(data){
data.aaData.each(function() {
data.aaData[i].push("");
});
}
} );
},
"aoColumns":[
null, null, null, null, null,
{ "sTitle": "view",
"fnRender": function(obj){
return 'hello';
}
}
]
});
[/code]
[code]$('#courses').dataTable({
"sPaginationType": "full_numbers",
"bServerSide": false,
"bJQueryUI": true,
"bProcessing": true,
"bVisible": true,
"sAjaxSource": 'GetAvailableCourses',
"fnServerData": function ( sSource, aoData, fnCallback ) {
/* Add some data to send to the source, and send as 'POST' */
aoData.push( { "client" : "jquery" } );
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": function(data){
data.aaData.each(function() {
data.aaData[i].push("");
});
}
} );
},
"aoColumns":[
null, null, null, null, null,
{ "sTitle": "view",
"fnRender": function(obj){
return 'hello';
}
}
]
});
[/code]
This discussion has been closed.
Replies
Allan