Link to home
Start Free TrialLog in
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

ASKER CERTIFIED SOLUTION
Avatar of Mukesh Yadav
Mukesh Yadav
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of peter-cooper
peter-cooper

ASKER

Thanks for the help
You are welcome! :)
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