我在同一页面上查看了登录和注册表单。我想只返回错误消息而不刷新整个页面。我怎样才能做到这一点?
public function signup() {
$this->form_validation->set_rules('user_name', 'User name', 'min_length[4]|is_unique[ts_user.user_name]|xss_clean');
$this->form_validation->set_rules('user_twitter_id', 'User Twitter ID', 'is_unique[ts_user.user_twitter_id]|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[8]');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[ts_user.email]');
if($this->input->post('submit') == TRUE) {
if($this->form_validation->run()) {
$twitterid = $this->input->post('user_twitter_id');
$username = $this->input->post('user_name');
$email = $this->input->post('email');
$password = $this->input->post('password');
$this->Usermodel->add_user($twitterid, $username, $email, $password);
echo 'Successful.';
} else {
echo validation_errors();
/*$this->load->view('registration_view');*/
}
}
}