I
I
Igor2015-12-10 11:09:20
PHP
Igor, 2015-12-10 11:09:20

How to connect a "callback" to the VI with your own code without a plugin?

welovepavel.esy.es
is the code for the JJ inserted into the outside page of the WP.
he addresses to push the handler, which is on the same server.

<div class="zvon">
                            <h3>Заказать звонок</h3>
            <form id="form">
                    <input class="ip1" placeholder="Ваше имя" required="" name="name" type="text">
                    <input id="phone23" class="ip1" placeholder="Ваш телефон" required="" name="phone" type="text">

                    <input value="Отправить" onclick="" type="submit">
          </form>
        </div>
  <script>

    $(function() {
    	$("#form").submit(function(e) {
            e.preventDefault();
            if([].every.call($(".ip1"), function(e){ return e.value.length })){
    			$.ajax({
    				type: "POST",
    				url: "http://welovepavel.esy.es/wp-content/mail.php",
    				data: $(this).serialize()
    			}).done(function() {
    				$(this).find("input").val("");
          	    	swal("Спасибо за заявку!", "Мы скоро свяжемся с Вам.","success");
    				$("#form").trigger("reset");
    			});
            }else{
                swal("Ошибка", "Не заполнены все поля", "error");
            }
        });

    	$("#phone23").mask("+7 (999) 999-9999");
    });

  </script>
">
And here is the push handler itself
<?php

$recepient = "[email protected]";
$sitename = "Аренда техники заявка на звонок";

$name = trim($_POST["name"]);
$phone = trim($_POST["phone"]);
$text = trim($_POST["text"]);
$message = "Имя: $name \nТелефон: $phone \nТекст: $text";

$pagetitle = "Новая заявка с сайта \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient");
?>

1.why is it not working?
2.how to fix the situation?
3. If it works, I and SweetAlert want to bang to them.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Bukhalo, 2015-12-10
@evilsprut

Write technical specifications for the site right away, and we will write the whole code for you, which is already there.

M
mr_dev1l, 2015-12-10
@mr_dev1l

I do not understand why write something of your own? Contact Form 7 and that's it, nothing more and everything will work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question