API not Working with Server

API not Working with Server

zernikzernik Posts: 2Questions: 0Answers: 0
edited February 2010 in General
Allen, I can't run any other API call after table initialization.
var my_table;
if (!my_table) { // ***this is the first click and it works, the table gets populated***
my_table = $('#my_table').dataTable({
"bProcessing": true, // show the "processing" icon
"bServerSide": true, // get the data from the server
"sAjaxSource": '/new_reports/nhl_manage_reports_ifr.phtml',
"fnServerData": function(sSource,aoData,fnCallback) { // POST params
aoData.push({"name":"field_limit","value":field_limit});
$.getJSON(sSource,aoData,function(json) {
fnCallback(json)
alert("After ajax return");
});
});
} else { // ***this is the next click, and it fails -- the call goes to the server, the server comes back, but the table does not "accept" the ajax data. it keeps saying "processing".***
ajax("before ajax");
my_table.fnDraw(false);
//my_table.fnClearTable(true); // any other API, they all fail
alert("after ajax ");
}

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    It looks like you've got a Javascript error here - 'ajax("before ajax");'. That should be 'alert()' should it not? Also don't pass anything to fnDraw, just my_table.fnDraw() will do to refresh a server-side processing table.

    Does firebug show anything? Also is the second returned JSON valid ( http://jsonlint.com )? Can you post a link to an example please?

    Allan
This discussion has been closed.