JSON not being processed when received?

JSON not being processed when received?

peetahzeepeetahzee Posts: 1Questions: 0Answers: 0
edited June 2010 in General
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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You need to call the callback function fnCallback. For example: http://datatables.net/examples/server_side/custom_vars.html

    Allan
This discussion has been closed.