javascript alert box not showing on php after header redirect
<p>I am trying to display an alert box before redirecting to another page, here is my code, when I remove the header function it works properly but when it is here it will just redirect to the page without showing the alert box.</p>

<pre><code>&lt;html&gt;
    &lt;body&gt;
        &lt;?php
        include("dbconfig.php");

        $tempid = mysqli_real_escape_string($dbconfig, $_POST['tempid']);

        $sql_query = "DELETE FROM Visits
    WHERE visitid = '$tempid'";
        $result = Mysqli_query($dbconfig, $sql_query);
        if ($result) {

            echo '&lt;script language="javascript"&gt;';
            echo 'alert("visit deleted successfully")';
            echo '&lt;/script&gt;';

            header("location:../SearchCountry/search.php");
        }
        ?&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>