Reputation: 425
When I sign up for a new account, and everything is successful, this part of the code runs and changes the form to display the message "Check your email[...]". I'm trying to make the message display for only a few seconds, then redirect back to the home page.
_("signupbutton").style.display = "none";
status.innerHTML = 'please wait ...';
var ajax = ajaxObj("POST", "signup.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
if(ajax.responseText != "signup_success"){
status.innerHTML = ajax.responseText;
_("signupbutton").style.display = "block";
}else {
window.scrollTo(0,0);
_("wrap").innerHTML = "<div >Check your email inbox to complete the sign up process by activating your account.</div>";
Upvotes: 0
Views: 602
Reputation: 1068
as was mentioned in a comment, you only need to use a setTimeout
and location
_("signupbutton").style.display = "none";
status.innerHTML = 'please wait ...';
var ajax = ajaxObj("POST", "signup.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
if(ajax.responseText != "signup_success"){
status.innerHTML = ajax.responseText;
_("signupbutton").style.display = "block";
}else {
window.scrollTo(0,0);
_("wrap").innerHTML = "<div >Check your email inbox to complete the sign up process by activating your account.</div>";
setTimeout(function() {
window.location = 'homepage.html'; // or whatever the URL is
}, 10000);
Upvotes: 1