我有这段代码:jQuery的POST数据回报比较不工作
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
回声的“X”,如果事情是错误的。
我想比较从reminme.php的输出,但即使它回声的x,条件data == "x"
不起作用。
我加入alert(data)
,我可以看到它正确显示需要的时候x
..
尝试'警报( ' '+ X +''“)'。任何空格? – ori
@ori nope,没有空格。返回“x” –
“alert(typeof data)”的输出是什么;'? –