D
D
Dmitry2018-04-02 22:43:03
PHP
Dmitry, 2018-04-02 22:43:03

jquery not sending data from input?

Hello, there is a code:

set(n) ;
    $(document).on("click","#sends",function () {
        Win[3]= $("#phone").val();
        Win[4]= $("#email").val();
        Win[6] =" Правильных ответов " + Win[2] + " из 25";
            var send_data = {"name":Win[0], "city":Win[1], "phone":Win[3], "email":Win[4], "level":Win[5], "test":Win[6]};
            $.ajax({
                url: "/send.php",
                type: "POST",
                data: send_data,
                success:function(t) {
                  console.log(t);
                }
            })
                    $(".for_general").css("text-align","center");

             $(".for_general").html("<h5> Ваша заявка отправлена </h5> </br> <h5> Наш администратор свяжется с вами </h5>")

setTimeout(function(){  window.location.reload()  ; }, 3000);

    })
    })
    $(document).on("click","#send_ms",function () {
        general= $(".general");
        general.removeClass("general");
        general.addClass("for_general") ;
        // .css("text-align","right");
        // $(".general").css("padding","10px");
        // $(".general").css("width","460px");
        $(".for_general").css("margin-left","330px");
        $(".for_general").css("margin-top","130px");
        $(".for_general").css("width","460px");
        $(".for_general").css("text-align","right");
        $("#sends").css("margin-right","22px");
        $("#sends").css("margin-top","10px");

      $(".for_general").html("<form><label style='margin-right: 20px' for='phone'>Телефон:</label> <input style='' name='phone' type ='text' id='phone'></br>" +
          "<label style='margin-right: 20px' for='email'>Ваш E-mail:</label> <input style='' name='email' type ='text' id='email'>" +
          "</br><button style=' margin-top: 10px;margin-right :22px; 'class='btn btn-outline-info' id='sends'>Отправить контакты </button> </form>")


})

And here is what I get via json:
array(4) {
["name"]=>
string(3) "Max"
["city"]=>
string(4) "cata"
["level"]=>
string(59) "Your English level is Elenentary А1"
["test"]=>
string(46) " Correct answers 8 out of 25"
}

2 inputs were not sent

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question