我正在提交一个表单巫婆发送电子邮件:
JS
var that = $(this); $.ajax({ url: '../wp-content/themes/bsj/PHP/validate.PHP',type: 'post',context: that,data: $('#sign-up').serialize(),cache: false,success: function(){ alert('success!'); },error: function(){ alert('error!'); } });
/*---------------------------------- Variables ----------------------------------*/ // Personal info $prefix = $_POST['prefix']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $company = $_POST['company']; $email = $_POST['email']; $title = $_POST['title']; $dept = $_POST['dept']; // Contact details $address = $_POST['address']; $address2 = $_POST['address2']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $ext = $_POST['ext']; $fax = $_POST['fax']; // Job Summary $job_title = $_POST['job_title']; $positions = $_POST['positions']; $hours = $_POST['hours']; $age = $_POST['age']; $wage = $_POST['wage']; $wage_type = $_POST['wage_type']; $job_description = $_POST['job_description']; $comments = $_POST['comments']; /*---------------------------------- Mail Form ----------------------------------*/ $to = 'email@email.com'; $subject = 'Subject'; $headers = 'From: noreply@email.com' . "\r\n" . 'Reply-To: noreply@email.com' . "\r\n" . 'X-Mailer: PHP/' . PHPversion(); $message = '### Personal Information ###' . "\r\n\r\n" . 'Prefix: ' . $prefix . "\r\n" . 'First Name: '. $first_name . "\r\n" . 'Last Name: ' . $last_name . "\r\n" . 'Company: ' . $company . "\r\n" . 'E-Mail: ' . $email . "\r\n" . 'Title: ' . $title . "\r\n" . 'Dept.: ' . $dept . "\r\n\r\n"; $message .= '### Contact Details ###' . "\r\n\r\n" . 'Address: ' . $address . "\r\n" . 'Address 2: ' . $address2 . "\r\n" . 'City: ' . $city . "\r\n" . 'State: ' . $state . "\r\n" . 'Phone: ' . $phone . "\r\n" . 'Ext.: ' . $ext . "\r\n" . 'Fax: ' . $fax . "\r\n\r\n"; $message .= '### Job Description ###' . "\r\n\r\n" . 'Job Title: ' . $job_title . "\r\n" . 'Positions: ' . $positions . "\r\n" . 'Hours: ' . $hours . "\r\n" . 'Age: ' . $age . "\r\n" . 'Wage: ' . $wage . ' - ' . $wage_type . "\r\n" . 'Job Description: ' . $job_description . "\r\n" . 'Comments: ' . $comments; mail($to,$subject,$message,$headers);
我正在设置,因为我使用模态窗口插件来显示表单,这样我得到正确的范围.
主要的问题是,当我点击提交时,电子邮件在我的收件箱中很好,但它总是执行错误功能,而不是成功的.
这是驾驶我的坚果,我看着每个人都没有运气的答案.
我得到了成功的回调几次,但现在它不再工作,我不知道为什么.我正在收到电子邮件很好…
我使用Chrome开发人员工具检查了响应标题,我得到200 OK,所以它已经恢复了.问题是什么?
编辑:嗯,我5点钟之后,我放弃了.我明天再回来试试其他的事情.我现在只需使用完整的,可以正常工作.我认为它可能与服务器有关.客户端正在使用IIS