Javascript, AJAX, Extend PHP Session Timeout, Bank Timeout
Posted
by Guhan Iyer
on Stack Overflow
See other posts from Stack Overflow
or by Guhan Iyer
Published on 2010-05-17T20:00:03Z
Indexed on
2010/05/17
20:10 UTC
Read the original article
Hit count: 545
Greetings,
I have the following JS code:
var reloadTimer = function (options) {
var seconds = options.seconds || 0,
logoutURL = options.logoutURL,
message = options.message;
this.start = function () {
setTimeout(function (){
if ( confirm(message) ) {
// RESET TIMER HERE
$.get("renewSession.php");
} else {
window.location.href = logoutURL;
}
}, seconds * 1000);
}
return this;
};
And I would like to have the timer reset where I have the comment for RESET TIMER HERE. I have tried a few different things to no avail. Also the code calling this block is the following:
var timer = reloadTimer({ seconds:20, logoutURL: 'logout.php',
message:'Do you want to stay logged in?'});
timer.start();
The code may look familiar as I found it on SO :-)
Thanks!
© Stack Overflow or respective owner