Session Expired
Session Expired
mike_yao
Posts: 1Questions: 0Answers: 0
Hello Allan,
I have a question about the ajax soruce fie expired, if session expired it wrote [code]Response.Write("[{\"error\": \"expired\"}]");[/code],
the datatable show "processing", why?
what can i do?
thank you
I have a question about the ajax soruce fie expired, if session expired it wrote [code]Response.Write("[{\"error\": \"expired\"}]");[/code],
the datatable show "processing", why?
what can i do?
thank you
This discussion has been closed.
Replies
What I did was, in case of session expiration, simply output 'Session timeout, returning to login page.' and then in your ajax call, on success run a function to check for a string being returned instead of proper json. My function is as follows:
[code]
// check for session timeout from ajax call
$.fn.checkSessionTimeout = function(toCheck) {
if($.trim(toCheck) == 'Session timeout, returning to login page.'){
document.location.href='index.cfm?fuseaction=login.form';
return false;
}
}
[/code]
[code]
$.ajax({
type: "GET",
url: "ajax_source.cfm",
data: { filter_id: $.trim($('#storedFilter_id').val()) },
success: function(formula_list){
// check for session timing out
$.fn.checkSessionTimeout(formula_list);
// do other thing
$.fn.actionUponSuccess(formula_list);
}
});
[/code]
I am using Coldfusion, but the js should work the same
http://datatables.net/forums/discussion/4377/catch-text-returned-from-server-side-ajax-call#Item_2