How to put the value of a field acquired with jquery in php?

0

I want to make a check try as a parameter the date of a datepicker and the id of an item.

        <script>
            $('.menu-item').click(function() {  

              var item = $(this).attr('value');
              alert(item);
            });
        </script>

         <script>
        $("#delivery_time").click(function() {   

            $.ajax
                    ({
                        beforeSend: function () {
                            $("#oi").html("Carregando...");
                        },
                        success: function ()
                        {

                            var datahora = $("#delivery_date").val();
                            <?php 

                            //Conexao ao banco e contator 
                                    $conecta = mysqli_connect("localhost", "root", "","alugaq")or die("Erro ao conectar!");
                                    $sql = "SELECT * FROM 'mt_order' WHERE 'merchant_id' LIKE '%$merchant_id%' AND 'item_id' LIKE '%$item%' AND 'delivery_date' LIKE '%$data%'" ;
                                    $query = mysqli_query($conecta,$sql);
                                    $qtd = mysqli_num_rows($query);       
                            ?>
                            alert($(".ui-state-default:contains('00')").css('display','none'));
                            alert(datahora);
                            alert(item);
                            alert(<?php echo $qtd ;?>);

                        }


                    });


    });
    </script>

I need the variable item and the variable datetime to work in the query, but I do not know how to put the javaScript variables in php.

    
asked by anonymous 04.01.2017 / 14:31

0 answers