JavaScript开关不适用于jQuery AJAX响应

Update: Problem solved, I had used a wrong character encoding.


I'm trying to build a login for a web application. The process is as follows:

  1. jQuery sends AJAX request with username and password to the PHP-backend.
  2. The PHP backend validates the values, sets session variables and returns either missingAuthField, unknownUser or wrongPassword as a plain string (Content-Type is also text/plain).
  3. The success event of the AJAX request has to differentiate the response and should either show an error message or has to reload the page (in case of successful login).

The problem occurs at step three. Only if the response is "missingAuthField", the wanted action happens, but if the response is e.g. "unknownUser", nothing happens.
By the way: I'm using jQuery 1.10.2 and the material-design 1.5 library in my project.

The relevant function:

mywebapp.authenticate = function (){
    var user = $("#t_auth_user").val();
    var pass = $("#t_auth_pass").val();
    $("#loading").removeClass("hidden");
    $("#hint_auth").text("");
    $.ajax("backend/auth.php", {
        cache: false,
        method: "POST",
        data: {
            "user": user,
            "pass": pass
        },
        success: function (resp){
            console.log(resp); // console output works fine with each response
            switch(resp){
                case "missingAuthField":
                   $("#hint_auth").text("not everything entered");
                   break;
                case "unknownUser":
                   $("#hint_auth").text("unknown user");
                   break;
                case "wrongPassword":
                   $("#hint_auth").text("wrong pass");
                   break;
                case "successful":
                   document.location.reload();
                   break;
            };
        },
        error: function (e, type){
            // my default error handling
        }
    });
};

Thanks for every answer!
~ Erik