Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery中post方法的问题_Jquery - Fatal编程技术网

jquery中post方法的问题

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

我正在尝试使用jQuery发送输入。虽然我已经成功并获得了输出,但我的问题是我无法对输出执行操作

    $('#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”的警报对话框吗显示?您确定它后面没有空格吗?可能>尝试警报(“!”+数据+“!”);是的,当然我已经检查过它没有空格。。。