I'm using this to call data using ajax in Tabulator:
$('#tablename').tabulator({
ajaxURL: some url,
ajaxConfig:"POST",
ajaxParams:{...}
});
I have an error handler like this that will return json if there's a problem.
function returnError($msg) {
$data=array();
$data['success'] = false;
$data['message'] = $msg;
echo json_encode($data);
exit;
}
How to I get that error from the Tabulator call, if it exists?
Not sure if standard ajax done can be appended to tabulator call? :
.done(function(data) {
if (data.success == false) {...}
});
Thanks.
There is an ajaxError callback you can use on tabulator, that is called whenever there is a request error. you simply define it in your table definition:
$('#tablename').tabulator({
ajaxURL: some url,
ajaxConfig:"POST",
ajaxParams:{...}
ajaxError:function(error){
//error - the returned error object
//your code goes here
},
});
A full list of available callbacks can be found in the Callback Documentation