I'm making a forum and I want the user panel to change whenever a user is logged in. So by default it says "Sign in or register." But when a user is logged in it says their name and an option to log out.
The idea is that when they click sign out jQuery will ask for a confirm and if its true they will be redirected to ?logout=true where php handles the rest.
The problem is that jQuery just won't work on the element echoed by php.
Here is the PHP:
<div id="userbar">
    <span id="userPanel">User Panel</span>
    <?php
        if (isset($_SESSION['signedIn'])) {
            echo '
                <a href="#" class="logout">Sign Out</a>
                <span id="welcome">
                    Hello, <b><a href="#" class="sessName">' . $_SESSION["username"] . '
                </b></a></span>
            ';
        } else {
            echo '
                <a href="signin.php" class="signIn">Sign In</a>
                <a href="signup.php" class="register">Register</a>
            ';
        }
    ?>
</div>
And here is the jQuery:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
    $(".logout").click(function(){
        var exit = confirm("Are you sure you would like to sing out?");
        if (exit == true) {
            window.location("header.php?logout=true");
        }
        return false;
    });
</script>
 
     
     
    