We help IT Professionals succeed at work.

How do i use the await event in php echo

peter-cooper
peter-cooper asked
on
144 Views
Last Modified: 2017-04-20
Hello
I have a script that echoes to a location at the end of a mysql query. I need to set a time before the function executes and found that the javascript event is 'await. I have tried in my code, but all I get is 500 error. Can someone please help with this. Thanks

echo "<script language=\"JavaScript\">\n"; 
echo 'alert("SUCCESS. You will now be redirected to the boxes requests area.");'; 
echo 'await sleep(4000)';
echo 'location.href = "boxdest.php"'; 
echo "</script>";

Open in new window

Comment
Watch Question

Full Stack Developer
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
Thanks for the help
Mukesh YadavFull Stack Developer
CERTIFIED EXPERT

Commented:
You are welcome! :)
Most Valuable Expert 2011
Author of the Year 2014

Commented:
The corresponding functions in PHP are
http://php.net/manual/en/function.sleep.php - for long delays
http://php.net/manual/en/function.usleep.php - for short delays