PHP - 如何在退出到Ajax后更改PHP会话

I have a Login.php page where I post login information with AJAX to login.php. When I post Information, my Session values changed (in php and not in Html that Conditional with php). I use Session Value for Conditional Statement in Login.php. As long as page is not refreshing my Conditional not Accrue.

In php Statement :

        if ($securimage->check($_POST['captcha_code']) == false) {
            echo 2;
            exit();                
        } elseif ($count == 1) {
            $_SESSION['Username'] = $Username;   
            $_SESSION['Result'] = $nArray;
            $_SESSION['Captcha'] = 0;
            if ($remember) {
                setcookie("Username", $Username, time() + 60, "/");                    
            }
            echo 1;
            exit();
        } else {                
            $_SESSION['Captcha'] ++;
            echo 0;
            exit();
        }

In Conditional Statement :

          <?php
            if ($_SESSION['Captcha'] >= 3) {
                ?>                            
                <div style="width: 380px; margin-right: 20px; margin-left: -40px;" >
                    <img id="captcha" style="border: 1px solid #000; margin-right: 20px;" src="securimage/securimage_show.php?" alt="CAPTCHA Image" align="left">
            <?php
            }
            ?>

You need to use Javascript to make the div show after 3 tries. PHP is executed on the server, not in the browser. Your "conditional" is only run when the page is served, not everytime you do an XHR.