这是我的 javascript 视图,控制器正在调用。javascript
$('#contact').submit(function(e){
e.preventDefault();
var name= $('input[name=contactname]').val();
var email= $('input[name=contactemail]').val();
var message= $('textarea[name=message]').val();
$.post("index.php/homepage/sendMail",{name:name, email:email, message:message},
function(){
$('#contactUsMask').hide();
$('#contactAckMask').show();
});
});
控制器
$from = $_POST['email'];
$msg = $_POST['message'];
$name = $_POST['name'];
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from($from, $name);
$this->email->to($to);
$this->email->subject($sub);
$this->email->message($msg);
if($this->email->send())
{
return true;
}
else
{
echo $this->email->print_debugger();
return false;
}
我无法阅读帖子变量,请帮忙。赞赏所有努力