How to Check Expired Sessions using PHP & jQuery Ajax

    How to Check Expired Sessions using PHP & jQuery Ajax

    My readers are asking that how do we display message to users that their sessions got expired. So I thought this tutorial will really useful to lots of web developer who working on session based websites.

    I have used javascript timing event –  setInterval() – executes a function, over and over again, at specified time intervals

    The setInterval() method will wait a specified number of milliseconds, and then execute a specified function, and it will continue to execute the function, once at every given time-interval.

    One Reply to How to Check Expired Sessions using PHP & jQuery Ajax

    1. Adrian Oprea says:

      I’d use setTimeout instead of setInterval and recursively call your function as AJAX will not return after your exact interval so your function might make the request multiple times. On the other hand, setTimeout will wait for 5s, for example, after your function completes, and only then, it will call it again.

    Leave a Reply