I have this bit of code:
function addEmail() {
email = $("#email").val();
atime = $("select#time").val();
tid = <?= $tid; ?>;
$.post("remindme.php", { email: email, time: atime, tid: tid },
function(data) {
if (data == "x") {
alert(data);
$('#remindme').modal('hide');
$('#quota').show();
}
else {
alert(data);
$('#remindme').modal('hide');
$('#remindersuccess').show();
}
});
}
remindme.php echo’s “x” if something is wrong.
I’m trying to compare the output from remindme.php but even though it echo’s the x, the condition data == "x" does not work.
I added alert(data) and I can see it properly displaying the x when needed..
If the server echoes the
xstring then theif (data == 'x')test inside the success callback should work. Your problem is somewhere else.