JQUERY SET TIMEOUT code example

Example 1: settimeout jquery

setTimeout(function(){ alert("Hello"); }, 3000);

Example 2: settimeout javascript

setTimeout(function(){
 	console.log("hello");
}, 3000); //wait for atleast  3 seconds before console logging

Example 3: js settimeout

setTimeout(() => { alert('Hello') }, 1000)

Example 4: add set time out in jquery

$(".submit_wide").click(function () {
    $(this).val('Please wait..');
    $(this).attr('disabled', true);
    setTimeout(function() { 
        $(this).attr('disabled', false);
        $(this).val('Submit');
    }, 2000);
});

Example 5: php expire a session

//Ending a php session after 30 minutes of inactivity
$minutesBeforeSessionExpire=30;
if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > ($minutesBeforeSessionExpire*60))) {
    session_unset();     // unset $_SESSION   
    session_destroy();   // destroy session data  
}
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity

Example 6: settimout jquery

setTimeout(function(){ alert("Hello"); }, 3000);