Answer the question
In order to leave comments, you need to log in
Why does 405 Not allowed appear on different hostings?
Hello. On one hosting - everything is super, on the other, when sending an ajax request, such an error appears and the GET AJAX request is not executed and the further function.
ajax request:
<script>
$("#feedback-form").click(function () {
var name = "Новый клиент";
var phone = $("#phone").val();
$.ajax({
url: "include/mail.php",
cache: false,
data: ({type:"mail", name:name,
phone:phone
}),
success: function(html){
$("#feedback-form").hide();
$("#mail_ajax").html(html);
}
});
return false;
});
</script>
if($_GET['type'] == 'mail') {
$name = trim($_GET['name']);
$phone = trim($_GET['phone']);
$fromMail = '[email protected]';
$fromName = '[email protected] НОВАЯ ЗАЯВКА';
$emailTo = '[email protected]';
$subject = 'Заявка с сайта';
$subject = '=?utf-8?b?'. base64_encode($subject) .'?=';
$headers = "Content-type: text/plain; charset=\"utf-8\"\r\n";
$headers .= "From: ". $fromName ." <". $fromMail ."> \r\n";
$body = "Получено письмо с сайта \n Имя: $name\nТелефон: $phone";
if (strlen($phone) > 0) {
if($mail = mail($emailTo, $subject, $body, $headers, '-f'. $fromMail )) {
echo "Сообщение отправлено";
}else{
echo "Не отправлено";
};
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question