开发者

Issue with post method in jquery

I am trying to send input using jQuery. Though I have succeeded and getting output but my issue is I am unable to perform action on output..

    $('#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('');
                    }
            });
    });

I have got ouput as YES as well as BLANKVALUE I tried using alert. but the action is not performed. as I tried alert in these condition I come to know its escaping condition.


Try this:

$('#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('');
        }
    });
});

Even when data is "YES", it was going in to the final else with your code

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜