这是我的jquery函数。我可以成功获得正确的价值 当我使用if和else语句中的值时,它不起作用
function retrieveData() {
$.ajax({
type: "GET",
url: 'http://localhost/DB/login.php',
data: {
email: $("#email").val(),
pass: $("#pass").val()
},
success: function(data) {
var response = data;
if (response == 'Employee') {
window.location.href = "#employees_details";
} else if (response == 'Employer') {
window.location.href = "#job_details";
} else {
alert(error);
}
}
});
//this is mandatory other wise your from will be submitted.
return false;
}