Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82458

Need advice when XHR object is returned in response

$
0
0

Hello,

I developed a site that uses DataTable plugin (all of them load data using Ajax). This site has a user authentication mechanism.

What I need to accomplish is, when the datatable is refreshed (by mean of a sort, filter, etc.) and the session has expired, a custom message should be shown and then redirected to login page.

I have implemented this event handler:

       tblCampos.on('xhr.dt', function (e, settings, json, xhr) {
                            checkUserSession(xhr);
                        });

where tblCampos is the datatable.

That works partially. When the user session has expired, a custom message is shown, but the dataTable also shows an alert telling that DataTable receives an invalid JSON response (actual messge is: "DataTables warning: table id=campos - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1"). How can I avoid that error message to be shown?

Regards
Jaime


Viewing all articles
Browse latest Browse all 82458

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>