I have a $.ajax request, and when i send response data with success:function(data), I get the data but for some reason I can't use it in If Statement:
$.ajax({
type: "POST",
url: "control.php",
data: {"txtNumFattura" : $("#txtNumFattura").val(),
"txtDataFattura": $("#txtDataFattura").val()},
success: function(data) {
console.log(data);
if (data == 'OK') {
console.log("Chiave non ancora utilizzata");
$("#submitMyForm").removeAttr("disabled");
}
else if(data == 'KO') {
$("#mySubmitForm").attr("disabled","disabled");
console.log("Chiave Utilizzata");
};
}
});
For instance console.log gives me "OK" or "KO" but it seems like it doesn't read it in the if Statement.