How to make javascript code to run after page redirection?

Hi,
I use this code to redirect my current page. I want to give an alert to the user after redirection. I use these codes:

header("Location: ../../admin/manage");
echo '<script type="text/javascript">fail();'
</script>';
script>
function success() {
alert("File deleted successfully!");
}
function fail() {
alert("File not found");
}
</script>

The alert is not shown.

?

If you are redirected to a different page… YOU ARE NO LONGER ON THAT PAGE.

What makes you think the following JS code would execute… if you are no longer on that page?

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service