What is the best approach for session expiration in datatable thru ajax?
What is the best approach for session expiration in datatable thru ajax?
step1020304050
Posts: 3Questions: 3Answers: 0
I'm using datatables api with ajax sourced data (http://datatables.net/examples/data_sources/ajax.html). My problem is that I want the page to do something, say, redirect when the session expires. In this case, datatable showed an error since the columns it is looking for is not available. What is the best way to approach session expiration in datatable thru ajax?
tbl.DataTable({
"ajax": {
"type": "POST",
"beforeSend": function(xhr){
loading_modal.modal('show');
},
"url": "/reports/get_transaction",
"data": function ( d ) {
d.params = frm.serializeArray();
}
},
"initComplete": function(settings, json) {
if(json.data == "session_timeout"){
redirect();
}
},
"columns": [
{ "data": "date" },
{ "data": "quantity" },
{ "data": "price" }
]
});
This discussion has been closed.