Since the session check is done server-side, you can do it with every
AJAX request server-side. If their session is not active anymore,
return a specific status for it. It's good to use JSON response for
this so you can return several sets of data, such as statuses, data,
etc.

On Feb 27, 12:45 pm, creemorian <creemor...@gmail.com> wrote:
> Along with every AJAX callback, I'd like to ensure that the user
> session is still active.
>
> So I have the following:
>
> >  jQuery.ajaxSetup({
> >    success: function(data, text)
> >    {
> >      if ( data.event == "login" ) {
> >        window.location.reload();
> >      }
> >    }
> >  });
>
> The aforementioned code functions perfectly well if the AJAX request
> object does *not* have the `({ success: ... })` method defined
> locally...
>
> Is there any way to make the global method always? Or a better way to
> respond to an expired user session via AJAX?
>
> Cheers for any suggestions.

Reply via email to