if(error == true){ // Your application has indicated there's an error window.setTimeout(function(){ // Move to a new location or you can do something else window.location.href = "https://www.kingjawab.com/index.php"; }, 5000); }