search

Home  >  Q&A  >  body text

Why can't I return data to ajax?


if (Request::isAjax()) {
$data = Request::except('password_confirm', 'post');
if (is_object(UserModel::create($data ))) {
Return ['STATUS' = & GT; 1, 'Message' = & GT; message' => 'Registration failed'];
}
}else{
return $this->error("Request type error", 'register');
}

cc2719cc27191842 days ago1055

reply all(2)I'll reply

  • 脑海里你的微笑最彻底

    脑海里你的微笑最彻底2020-01-20 19:33:26

    $ret = array( 'status' => 1, 'message' => 'Congratulations on successful registration' ); echo json_encode($ret);die;

    reply
    0
  • ringa_lee

    ringa_lee2020-01-20 09:33:26

    Change to json format, the array you returned is not recognized by js

    reply
    0
  • Cancelreply