ajax(jquery)调用返回false,当存在特定行时应返回true


ajax (jquery) call returns false, should return true when a particular row exist

我已经对此进行了一段时间的修补,任何好心的撒玛利亚人都可以帮忙,而不用诅咒我的问题太愚蠢了。如果发布的输入存在,我希望以下ajax登录函数返回true,这是我的代码php:

                    $cell = $_POST['cell'];
                $link = mysqli_connect("localhost", "user", "pass", "db");
                $query = "SELECT * FROM snoopers WHERE cell='$cell ' LIMIT 1";
                $result = mysqli_query($link, $query)or die(mysqli_error());
                $num_row = mysqli_num_rows($result);
                        $row=mysqli_fetch_array($result);
                        if( $num_row >0 ) {
                            echo 'true';
                        }
                        else{
                            echo 'false';
                        }
                mysqli_close($link);

下面是前面的

//Login
$("#login").click(function(e){
    e.preventDefault();
        $.ajax({
            type: "POST",
            url: "http://localhost/sc/new/lib/login.php", 
            datatype:"application/json",
                data: {
                    cell: $("#cell").val()
                    },
                timeout: 6000, 
                success: function(html)
                {
                    $("#result").html(html).show();
                },
                //success: function(html){ if(html=='true') { alert("True"); }else{alert("you are a failure");}},
                beforeSend:function(){
                     //$("body").html("Loading...")
                },
                complete:function(){
                }
            });                                                 
        }); return false;
});

更改

cell='$cell '

cell='$cell'