返回ajax响应

i have a function

function chkLogin() {
    $.get("setAlert.php", function (data) {
        $(".result").html(data);
        if (data == 'Not logged in') {
            alert("not logged in.");
        } else {
            alert("success");
        }
    });
}

setAlert.php

if (!isset($login_session)) { 
    return "Not logged in";
   }
   else{
 return "logged in";
}

and it alerts success because data is blank. So how can i set data to "Logged in " or "Not logged in" ? Please help.

查看全部
weixin_33729196
weixin_33729196
2014/03/10 08:27
  • php
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

3个回复