$ _SESSION变量未在AJAX调用中设置

I wrote this call for user authentication:

$( '.sign-in' ).click( function(e) {
    e.preventDefault();
    var logincall = $.ajax({
        type: "POST",
        url: "../snippets/auth.php",
        data: { username: $('#id_email').val(), password:   $('#id_password').val() }
    });
    logincall.done(function( result ) {
        alert( 'finished: ' + result );
        if( result == 'valid' ) {
            location.reload();
        } else {
            $( '.warning' ).toggleClass('hidden');
        }
    });
    logincall.fail(function( jqXHR, textStatus ) {
      alert( "Request failed: " + textStatus );
    });
});

and here's the auth.php function

if( isset($_POST['username']) && isset($_POST['password']) ) {

    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $query = "SELECT COUNT(*) FROM member WHERE username='$username' AND password='$password';";
    $result = $mysqli->query($query);
    $result = $result->fetch_array(MYSQLI_ASSOC);

    if( $result['COUNT(*)'] !== 0 ) {
        $_SESSION['logged'] = true; //this sets
        $query = "SELECT id, level FROM member WHERE username='$username' AND password='$password';";
        $result = $mysqli->query($query);
        $result = $result->fetch_array(MYSQLI_ASSOC);
        $_SESSION['uid'] = $result['id']; //this DOES NOT set
        $_SESSION['lvl'] = $result['level']; //this DOES NOT set
        echo json_encode('valid');
    } else {
        echo json_encode('invalid');
    }
}

The odd thing is, if I navigate directly to

myurl.com/snippets/auth.php?username=myusername&password=mypassword

it DOES set the other two session variables, but I can never get index.php to pick them up.

I even added that refresh line to it to ensure it could pick them up, and it gets $_SESSION['logged'] just fine, but not ['uid'] or ['level']