Q:

JavaScript Alert not working properly

I am showing an alert using javascript in my php page. It is not showing alert box. Kinldy guide me how to make it work fine
    

if($sql && $sql2 && $sql3) 
{
    echo "<script> alert('Deleted successfully!');</script>";
        $myURL = 'students_list.php';
        header('Location: '.$myURL);
        exit;
    else
{    
echo "<script> alert('Temporary problem, try again!');</script>";
}
?>

It is deleting data from database but not showing alert. Tell me how to make it work fine.

A:

do this
<script> alert('Deleted successfully!');window.location='students_list.php'</script>

like this when the alert is closed you redirect.

