How to get true or false from PHP function using AJAX?

后端 未结 6 1317
傲寒
傲寒 2021-01-23 14:31

I tested status.php return value with var_dump($result) and alerted it out in check() function like this:

function check() {
    $.ajax({
               


        
6条回答
  •  长发绾君心
    2021-01-23 14:42

    Just Remove Type checking i.e '===' replace with '=='

    function check() {
        $.ajax({
            url: "status.php"
        }).done(function(data) {
            if(data == true){
                alert("true");
            } else {
                alert("false");
            }
        });
    }
    

提交回复
热议问题