[eluser]jstine[/eluser]
Thanks for the reply. For some reason I still can't get it to work.
Here's my controller code:
Code:
$this->form_validation->set_rules('su_first_name', 'First Name', 'trim|required');
$this->form_validation->set_rules('su_last_name', 'Last Name', 'trim|required');
$this->form_validation->set_rules('su_user_email', 'Email', 'trim|required|valid_email|callback__check_su_user_email');
$this->form_validation->set_rules('su_user_pass', 'Password', 'required|matches[su_confirm_pass]');
$this->form_validation->set_rules('su_confirm_pass', 'Confirm Password', 'required');
if($this->form_validation->run() == false)
{
exit( json_encode( array('result'=>'error','msg'=>validation_errors() ) ) );
}
And my view's js:
Code:
var user_first = $("input#su_first_name").val();
var user_last = $("input#su_last_name").val();
var user_email = $("su_user_email").val();
var user_pass = $("su_user_pass").val();
var user_confirm = $("su_confirm_pass").val();
$.ajax({
type: "POST",
url: "myurl",
data: ({'su_first_name':user_first,'su_last_name':user_last,'su_user_email':user_email,'su_user_pass':user_pass,'su_confirm_pass':user_confirm}),
dataType:'json',
success: function(object) {
if(object.result=='error'){
alert(object.msg);//shows the validation errors.
}
}
});
Any ideas why it's still not working are appreciated!