Sweet Alert + Ajax doesnt work

I'm having trouble when the output produces false but does not appear sweet alert (nothing happens). Is there something wrong with ajax?


    include 'libraries/config.php';
    include 'function.php';


    $email    = trim($_POST['email']);
    $password = trim($_POST['password']);
    $pass     = encryptPwd($password);

    $cek    = mysqli_query($conn, "SELECT * FROM user_csr WHERE email='$email' AND csr_pwd='$pass'");  
    $result = mysqli_fetch_assoc($cek);
    $data   = mysqli_num_rows($cek);

    if($data == 1)
        echo "true";

        $_SESSION['ses-cus'] = $result['email'];
        $_SESSION['id-cus'] = $result['csr_id'];
        $_SESSION['expires_by'] = time()+600;
        echo "false";


$(document).ready(function() {
    $('#btn-submit').on('click',function() {

            type: "POST",
            url: 'tes.php',
            data: {
                    email: $("#mail").val(),
                    password: $("#pass").val()
            success: function(html)
                if (html.trim() == 'true')
                        title: "Login Success",
                        text: "",
                        type: "success"
                        }, function(){
                            window.location.href = "index.php";
                else if (html.trim() == 'false')
                        title: "Login Failed",
                        text: "",
                        type: "failed"
                        }, function(){
                            window.location.href = "login.php";

<input type="email" name="email" id="mail" required>
<input type="password" name="password" id="pass" required>
<button id="btn-submit" type="button">Sign In</button>

if I input the correct data it will appear sweet alert with the right conditions. enter image description here

if i write alerts (html); then if the data is true then the output: true, and when the data is wrong then the output: false

enter image description here

but when using sweet alerts like the script above, if I input wrong data,, sweet alert that execute beside 'true' does not appear. Hope anyone can help me out on this one, thanks in advance. Thanks