Php 在codeigniter中通过ajax发送电子邮件工作但不输入.done函数
我使用ajax调用发送电子邮件,一切正常,发送电子邮件时没有问题。但是ajax调用没有执行.done函数就完成了…它正在执行.fail函数,但我不明白为什么!!如果它工作完全正常,为什么要执行.fail函数?请帮我这里是我的代码: 阿贾克斯 控制器Php 在codeigniter中通过ajax发送电子邮件工作但不输入.done函数,php,ajax,email,codeigniter-3,Php,Ajax,Email,Codeigniter 3,我使用ajax调用发送电子邮件,一切正常,发送电子邮件时没有问题。但是ajax调用没有执行.done函数就完成了…它正在执行.fail函数,但我不明白为什么!!如果它工作完全正常,为什么要执行.fail函数?请帮我这里是我的代码: 阿贾克斯 控制器 if( $this->input->is_ajax_request()){ $captcha_answer = $this->input->post('g-recaptcha-response');
if( $this->input->is_ajax_request()){
$captcha_answer = $this->input->post('g-recaptcha-response');
$result = $this->validar($captcha_answer);
if ($result == 1) {
$mail = $this->input->post('contact_mail');
$name = $this->input->post('contact_name');
$msg = $this->input->post('contact_message');
$config = array(
'protocol' => 'esmtp',
'smtp_host'=> 'mail.novaderma.cl',
'smtp_port'=> 26,
'smtp_user'=> 'contacto@novaderma.cl',
'smtp_pass'=> '******',
'mailtype'=> 'html',
'charset'=> 'utf-8',
'newline' => '\r\n',
'crlf' => '\n'
);
$this->email->initialize($config);
$this->email->from($mail);
$this->email->to('contacto@novaderma.cl');
$this->email->subject('IMPORTANTE CORREO CONTACTO');
$this->email->message('<h2>PÁGINA NOVADERMA</h2>
<hr><br>
<br>
<p>'.$msg.'</p>
');
if ($this->email->send()) {
echo json_encode( array('success' => 1));
}
else {
echo json_encode( array('success' => 0));
}
/*echo $this->email->print_debugger();*/
}
else {
}
}
if($this->input->is\u ajax\u request()){
$captcha_answer=$this->input->post('g-recaptcha-response');
$result=$this->validar($captcha\u-answer);
如果($result==1){
$mail=$this->input->post('contact_-mail');
$name=$this->input->post('contact_name');
$msg=$this->input->post('contact_message');
$config=array(
“协议”=>“esmtp”,
“smtp_主机”=>“mail.novaderma.cl”,
“smtp_端口”=>26,
'smtp_用户'=>'contacto@novaderma.cl',
“smtp_pass”=>“*******”,
“邮件类型”=>“html”,
“字符集”=>“utf-8”,
“换行符”=>“\r\n”,
'crlf'=>'\n'
);
$this->email->initialize($config);
$this->email->from($mail);
$this->email->to($this)contacto@novaderma.cl');
$this->email->subject('importantente CORREO CONTACTO');
$this->email->message('PÁGINA NOVADERMA
“.$msg。”
');
如果($this->email->send()){
echo json_编码(数组('success'=>1));
}
否则{
echo json_编码(数组('success'=>0));
}
/*echo$this->email->print_debugger()*/
}
否则{
}
}
if( $this->input->is_ajax_request()){
$captcha_answer = $this->input->post('g-recaptcha-response');
$result = $this->validar($captcha_answer);
if ($result == 1) {
$mail = $this->input->post('contact_mail');
$name = $this->input->post('contact_name');
$msg = $this->input->post('contact_message');
$config = array(
'protocol' => 'esmtp',
'smtp_host'=> 'mail.novaderma.cl',
'smtp_port'=> 26,
'smtp_user'=> 'contacto@novaderma.cl',
'smtp_pass'=> '******',
'mailtype'=> 'html',
'charset'=> 'utf-8',
'newline' => '\r\n',
'crlf' => '\n'
);
$this->email->initialize($config);
$this->email->from($mail);
$this->email->to('contacto@novaderma.cl');
$this->email->subject('IMPORTANTE CORREO CONTACTO');
$this->email->message('<h2>PÁGINA NOVADERMA</h2>
<hr><br>
<br>
<p>'.$msg.'</p>
');
if ($this->email->send()) {
echo json_encode( array('success' => 1));
}
else {
echo json_encode( array('success' => 0));
}
/*echo $this->email->print_debugger();*/
}
else {
}
}