Я подозреваю, что что-то еще вызывает сбой Chrome до или во время вызова AJAX, и response
не заполняется или blur
не пузырится. Попробуйте следующий код и обновите свой пост. Также просмотрите вкладку «Сеть» до и после вызова ajax, чтобы узнать, отправляете ли вы неверные данные или получаете ошибку в ответе от PHP.
$(function() {
$('#username-signup').blur(function(e) {
console.log("Username Signup Blue Event");
$.ajax({
type: "POST",
url: "includes/identification.php",
data: {
username: $('#username-signup').val()
},
dataType: "text",
success: function(response) {
console.log(response);
if (response == 'n') {
//console.log('n');
$('#username-signup').removeClass('identication-y');
$('#username-signup').addClass('identication-n');
} else {
//console.log('else');
$('#username-signup').removeClass('identication-n');
$('#username-signup').addClass('identication-y');
}
},
error: function(x, t, err) {
console.log('Ajax Error:', x, t, err);
},
timeout: 5000
});
});
});
.identication-n {
border-color: #ff3547;
}
.identication-y {
border-color: limegreen;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="text" name="username" class="form-control" id="username-signup">