Jump to content

Delay output


MrXander

Recommended Posts

Hi.

 

Is there anyway to delay output displayed on a page?

 

I'm using this as part of registering for my new website. While the script checks that what the user has created, I want a small delay (of around 5 seconds or so) then the output, either being "TRUE" or "FALSE" to be sent back, WITHOUT redirecting to another page.

 

Any suggestions?

Link to comment
Share on other sites

If I understand you correctly, you want the user to enter information, press submit then in about 5 seconds output if it's valid or not? This seems like a very bad idea for many reasons.. But here's a basic example:

 

<script type="text/javascript">
function validate(username)
{
var t = setTimeout("check('" + username + "')", 5000);
}

function check(username)
{
alert('It\'s been 5 seconds..');
}
</script>
<form action="" method="" onsubmit="return false;">
<input type="text" name="username" />
<input type="submit" value="submit" onclick="validate(this.form.username.value)" />
</form>

 

Inside check() you'd want to perform any checks on the data..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.