Normally in core php if we try to make a request using ajax we set url of the file where the query exist so when switching same process in codeigniter but I got an error in response can anyone help me out with this error
net::ERR_SSL_PROTOCOL_ERROR
here is my code Javascript ajax
$.ajax ({
type : "POST",
url : "https://localhost:90/tufuturo/home/register",
data : {username: username, email: email, password: confirm_password},
dataType : "text",
success : function(data, text, xhr) {
if(xhr == 200) {
var return_data = data;
$('#messagebox').fadeIn(2000, function() {
$(this).html("<div class='message'>"+return_data+"</div>").delay(4000).fadeOut(3000);
});
}
}
});
Here is the code form my Home.php controller
public function register() {
$this->load->library('form_validation');
$this->form_validation->set_rules('username', '', 'required|trim|is_unique[users.username]');
$this->form_validation->set_rules('password', '', 'md5|trim');
if($this->form_validation->run()) {
$data = array(
'username' => $this->input->post('username'),
'password' => $this->input->post('password'),
'email' => $this->input->post('email'),
'type' => 'user'
);
$this->data_insert->add_admin($data);
echo 'New admin has been successfully created';
} else {
echo 'Username already taken';
}
}
Please let me know how can i get rid of this error