Session Expired

Session Expired

mike_yaomike_yao Posts: 1Questions: 0Answers: 0
edited July 2011 in DataTables 1.8
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

Replies

  • bill.martinobill.martino Posts: 38Questions: 0Answers: 0
    edited July 2011
    If I am understanding correctly, if the session has timed out and the user hits your ajax source file, then you are outputting a json object to denote the session has expired?

    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
  • bill.martinobill.martino Posts: 38Questions: 0Answers: 0
    Here is an earlier thread on it, done a slightly different way:

    http://datatables.net/forums/discussion/4377/catch-text-returned-from-server-side-ajax-call#Item_2
This discussion has been closed.