通常在核心php中,如果我们尝试使用ajax发出请求,我们设置查询存在的文件的url,所以当在codeigniter中切换相同的进程但是我得到了错误响应可以帮助我解决这个错误
净:: ERR_SSL_PROTOCOL_ERROR
这是我的代码 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);
});
}
}
});
这是我的Home.php控制器的代码形式
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';
}
}
请让我知道如何摆脱这个错误
答案 0 :(得分:2)
您的localhost不符合https
协议
更改https://localhost:90/tufuturo/home/register
的网址
到http://localhost:90/tufuturo/home/register
如果您想使用https
协议,则需要generate certificate
答案 1 :(得分:0)
如果你使用SSL(https),也许你需要从你的网址中取出:90。