Ajax success function not running...
Ajax success function not running...
jolyon2000
Posts: 12Questions: 0Answers: 0
Using v1.10.0 beta3: Callback 'success' function not running. No errors in console in Chrome ! Any ideas ?
oTable = $('#joetable').DataTable( {
dom: '<"top"p>rtS',
"ajax": function (data, callback, settings) {
settings.jqXHR = $.ajax({
"dataType": 'json',
"timeout": 20000,
"type": "POST",
"url": "/myurl/",
"data": data,
"success": function (){ alert("Callback ran!"); }
});
},
"bServerSide": true,
...
});
oTable = $('#joetable').DataTable( {
dom: '<"top"p>rtS',
"ajax": function (data, callback, settings) {
settings.jqXHR = $.ajax({
"dataType": 'json',
"timeout": 20000,
"type": "POST",
"url": "/myurl/",
"data": data,
"success": function (){ alert("Callback ran!"); }
});
},
"bServerSide": true,
...
});
This discussion has been closed.
Replies
I then tried the following which DID work:
[code]
settings.jqXHR = $.ajax({
"dataType": 'json',
"timeout": 20000,
"type": "POST",
"url": "/myurl/",
"data": data,
"success": callback
}).done(function( data ) {
alert("Callback ran!");
});
[/code]
Any reasons why the first method does not work?
> success - Must not be overridden as it is used internally in DataTables.
The documentation then states how to work around this.
Btw - I see you are posting a number of questions in the comments section of the pages. The comments section states that it is not for questions. If you have a question about a specific piece of documentation post post your question in a forum thread and I will update the documentation as appropriate to clarify the issue if needed.
Allan
Hi there, just wondering then on success of dataDable data how can i make a callback to run other function
jim4nz, for what its worth, I was able to achieve firing a function after the data was received/parsed like so
Which allowed me to load my data asynchronous, use a custom loading gif, and then call the column filter extension after the data was loaded.