Avatar of peter-cooper
peter-cooper
 asked on

How do i use the await event in php echo

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

PHPJavaScript

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mukesh Yadav

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Julian Hansen

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
peter-cooper

ASKER
Thanks for the help
Mukesh Yadav

You are welcome! :)
Ray Paseur

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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes