weixin_33739523 2017-04-18 07:48 采纳率: 0%
浏览 3

将值发回给ajax

Problem, is, if in x.php file I do following:

print_r($data->name);

then I get in Ajax call console.log(data); (Right data), but if I don't do print_r, I get null. I dont really want to print_r($data) in x.php, I just want to pass the value (without printing on screen) back to ajax function, so console.log($data) would show correct data and then manipulate it there with some html. How can I do this?

  • 写回答

1条回答 默认 最新

  • 关注
    header('Content-Type: application/json');
    echo json_encode($array);
    exit();
    
    评论

报告相同问题?