I have a web page with a huge form to fill. In most cases, session time out and users lost a lot of data. I searched for this problem and found this Prevent session expired in PHP Session for inactive user
I implemenet ajax call
function heartbeat() {
clearTimeout(window.intervalID);
$.ajax({
url: "trash.png",
type: "post",
cache: false,
dataType: 'json',
success: function(data) {
},
complete: function() {
window.intervalID = setTimeout(function() {
heartbeat();
}, 300000);
}
});
}
and call heartbeat();
in $(document).ready
, trash.png
is in the same directory as file where I have jQuery code with Ajax.
I checked with fiddler and jQuery is sending requests to trash.png
every 5 minutes. But after 30 minutes my session still expires.
session_start();
is called when user log in to the web page.
What am I doing wrong?