I have a form that I submit to a php file, the php file will check if the record exists or not. If it exists it will echo "Already Exists". In my ajax "success" it does see the "Already Exist" but when I place a condition it does not work. For example under success in my ajax function I placed the following
$.ajax({
type: "GET",
data: $('#minifrm').serialize(),
url: "CRUD/myfile.php?check=" + para + "&freq=" + freq + "&expire=" + expire,
success: function (status) {
if (status.success == false) {
alert("Your details we not saved");
} else {
var checkstatus = status.toString();
if (checkstatus === 'Already Exists')
{
alert("You are here");
}
if (checkstatus === '')
{
alert("There is nothing");
}
}
}
});
Currently it will echo "Already Exists" and alert "You are here" but if it doesn't exist it will not alert "There is nothing".