jquery中post方法的问题
我正在尝试使用jQuery发送输入。虽然我已经成功并获得了输出,但我的问题是我无法对输出执行操作jquery中post方法的问题,jquery,Jquery,我正在尝试使用jQuery发送输入。虽然我已经成功并获得了输出,但我的问题是我无法对输出执行操作 $('#email').blur(function(){ var email = $('#email').val(); $('#emailrespond').show().html('<img width="80" height="27" src="images/dot.gif" >'); $.post('showusers
$('#email').blur(function(){
var email = $('#email').val();
$('#emailrespond').show().html('<img width="80" height="27" src="images/dot.gif" >');
$.post('showuserstatus.php', { emailid: email }, function(data) {
if (data == "YES"){
$('#emailrespond').show().html('Registered');
}
if (data == 'BLANKVALUE'){
alert(data);
$('#emailrespond').show().html('<img width="27" height="27" src="images/error2.gif"');
}
else {
$('#emailrespond').show().html('');
}
});
});
$('#email').blur(函数(){
var email=$('#email').val();
$('#emailrespond').show().html('');
$.post('showuserstatus.php',{emailid:email},函数(数据){
如果(数据=“是”){
$('#emailrespond').show().html('Registered');
}
如果(数据=='BLANKVALUE'){
警报(数据);
$('#emailrespond').show().html('
我尝试使用alert时得到了输出YES和BLANKVALUE。但操作未执行。在这些条件下尝试alert时,我了解了它的转义条件。尝试以下操作:
$('#email').blur(function() {
var email = $('#email').val();
$('#emailrespond').show().html('<img width="80" height="27" src="images/dot.gif" >');
$.post('showuserstatus.php', { emailid: email }, function(data) {
if (data == "YES") {
$('#emailrespond').show().html('Registered');
} else if (data == 'BLANKVALUE') {
alert(data);
$('#emailrespond').show().html('<img width="27" height="27" src="images/error2.gif"');
}
else {
$('#emailrespond').show().html('');
}
});
});
$('#email').blur(函数(){
var email=$('#email').val();
$('#emailrespond').show().html('');
$.post('showuserstatus.php',{emailid:email},函数(数据){
如果(数据=“是”){
$('#emailrespond').show().html('Registered');
}else if(数据=='BLANKVALUE'){
警报(数据);
$('#emailrespond').show().html('
即使数据是“是”
,它也会与您的代码一起进入最后一个else如果您移动警报(数据),会发生什么在if块之外?我得到的是输出YES
以及BLANKVALUE
,但是如果我在if
条件下尝试它,它的转义条件意味着我在if
条件下没有得到警报。你说的输出是指一个带有单词“BLANKVALUE”的警报对话框吗显示?您确定它后面没有空格吗?可能>尝试警报(“!”+数据+“!”);是的,当然我已经检查过它没有空格。。。