0

PHP And JavaScript Intercept

I coded a download page where by PHP echos several links based on user's choice then JavaScript clicks on it and downloads it immediately and then PHP takes the user back to the home page. But then i discovered that PHP takes me back to the home page even before the download begin. Please can someone help me out i'm stuck

4th Aug 2020, 3:20 AM
Prosper Emebo
Prosper Emebo - avatar
1 ответ
+ 3
Heyao That's because the PHP is server sided, so the server will run all php code at once before sending you the final response. Js is on the other hand both sided, as you can still run js locally or use calls like ajax to ask for new server activities. To fix your problem, try using js for the redirect instead of PHP =)
16th Aug 2020, 7:37 AM
Krysto Foxik 🐥
Krysto Foxik 🐥 - avatar