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
https://forums.phpfreaks.com/topic/179853-delay-output/
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
https://forums.phpfreaks.com/topic/179853-delay-output/#findComment-948794
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.