$this->ajaxReturn()不能把数据返回到原页面

浏览:2005 发布日期:2015/11/18 分类:求助交流
class IndexController extends CommonController {
public function getUserInfo(){
$openid = $_POST['openid'];
$map['userid'] = $openid;
$map['name'] = 'jinxin';
$this->ajaxReturn(successJson($map,'数据获取成功'),'JSON');
}

class CommonController extends Controller {
public function _initialize(){
$result = is_login();
if(!is_login()){// 还没登录 跳转到登录页面
$this->ajaxReturn(successJson(array('name'=>'hehe'),'数据获取成功'),'JSON');
}
}

这里IndexController继承CommonController ,我希望在请求IndexController的getUserInfo()方法的时候自动判断用户有没有登陆,但是这里不能够把数据返回到html页面,而是到了一个空白页,空白页以字符串的方式显示我的json数据,html是用jquery的ajax做的请求,如果IndexController直接继承Controller 是可以把数据返回回去的。这里是为什么,求大神解决啊。
最佳答案
评论( 相关
后面还有条评论,点击查看>>