Error in comparison with response

0

I have this JS below, which I include at the end of my document. It sends the data via ajax to a PHP file that answers a text, in the example below -666 and logar .

It happens that it does not fall into the right condition. I see through the returned data and it does not fit. Started recently, I know this is not normal to hear, but yes, started less than 5 days after the application delivery.

See:

$(document).ready(function() {
    //enviando form
    $( document ).on( "click", "#bt_send", function() {
                f_submit();
    }); 
    function f_submit(){
        $('#message').html('<center><span style="color:#0091ea;"Processando</span></center>');
        var form_data = {
            email: $('#email').val(),
            senha: $('#senha').val(),
            is_ajax: 1
        };
        $.ajax({
            type: 'POST',
            data: form_data,
            url: 'php/acesso/login.php',
            success: function(response)
            {
                $('#message').html(response);
                switch (response)
                {                
                  case "-logar": 
                       $('#message').html('<span style="color:#00c853;"><center>Bem Vindo. Carregando permissões.</center></span>');
                       window.location = 'painel.php';
                       break;
                  case "-666": 
                       $('#message').html('<span style="color:#dd2c00;"><center>E-mail ou senha incorreto.</center></span>');
                       break;
                  default: 
                       alert(response);
                       break;
                }
            }
        });
    }
});
    
asked by anonymous 15.08.2018 / 00:27

0 answers