gpt4 book ai didi

javascript - 我在 codeigniter 中遇到错误

转载 作者:行者123 更新时间:2023-11-30 16:04:16 25 4
gpt4 key购买 nike

通常在核心 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 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';
}
}

请让我知道如何摆脱这个错误

最佳答案

您的本地主机不符合 https 协议(protocol)

https://localhost:90/tufuturo/home/register 更改 url到 http://localhost:90/tufuturo/home/register

如果你想使用https协议(protocol)你需要generate certificate

关于javascript - 我在 codeigniter 中遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37270456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com