API not Working with Server
API not Working with Server
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 ");
}
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 ");
}
This discussion has been closed.
Replies
Does firebug show anything? Also is the second returned JSON valid ( http://jsonlint.com )? Can you post a link to an example please?
Allan