Problems with PHP + jquery

0

How do I get a value from a button in jquery and move to another page?

My problem is to pass the order data I received from the bank and make this data appear on another page and I want to do with this + boot:

knife-your-request.php

<divclass="container">
            <div class="heading step-head text-center padding-top-25 padding-bottom-25 margin-bottom-0">
                <span><?php echo $rsCat['categoria_nome']; ?></span>
            </div>
            <?php
            $sqlSubcat =  "select subcategoria_id, subcategoria_nome from subcategoria where subcategoria_habilitado='1' and subcategoria_ativo='1' and categoria_id='".$rsCat['categoria_id']."'";
            $tbSubcat = mysql_query($sqlSubcat) or die(mysql_error());

            if(mysql_num_rows($tbSubcat) > 0){
                while($rsSubcat = mysql_fetch_array($tbSubcat)){
            ?>
                    <h6 class="step-head text-center padding-bottom-10"><?php echo $rsSubcat['subcategoria_nome']; ?></h6>
                    <ul class="pizza-flavers">
                        <?php
                        $sqlItem = "select item_id, item_nome, item_descricao, item_preco from item where item_habilitado='1' and item_ativo='1' and categoria_id='".$rsCat['categoria_id']."' and subcategoria_id='".$rsSubcat['subcategoria_id']."' order by item_nome";
                        $tbItem = mysql_query($sqlItem) or die(mysql_error());
                        if(mysql_num_rows($tbItem) > 0){
                            $i=1;
                            while($rsItem = mysql_fetch_array($tbItem)){

                        ?>
                        <li>

It selects the item, and the inputs, the problem is: when I click on + I want it to identify it and when I click on it it should appear with this data that I solved on another page:

"+" button Javascript

$(document).ready(function() {

  $(".pizza-add-sub").append('<div class="plus qty-pizza">+</div><div class="mines qty-pizza">-</div>');
  $(".qty-pizza").on("click", function() {

    var $button = $(this);
    var oldValue = $button.parent().find("input").val();
    if ($button.text() == "+") {
      var newVal = parseFloat(oldValue) + 1;
    } else {
      // Don't allow decrementing below zero
      if (oldValue > 0) {
        var newVal = parseFloat(oldValue) - 1;
      } else {
        newVal = 0;
      }
    }
    $button.parent().find("input").val(newVal);

    var valorTotal = 0;
    var valoresMultiplicar = 0;
    $(".qtdpedidos").each(function() {
      valorTotal += parseFloat($(this).data("preco") * $(this).val());
    })

    $(".item span").each(function() {
      valoresMultiplicar += parseFloat($(this).html());
    })

    if (valorTotal==0){
        $("#tot").text("");
        $("#resultado").text('');
    }else{
        $("#tot").text('R$'+(parseFloat(valorTotal+5).toFixed(2)));
        $("#resultado").text('R$'+parseFloat(valorTotal).toFixed(2));
    }




  });
});

When he clicks on the "Finish" button it should appear only what I have solved on another page:

Page that should appear the data:

Order confirmation screen

    
asked by anonymous 09.05.2017 / 16:56

1 answer

0

Good morning,

You can use a session class, you yesterday the identifier of your product, and save in an array its complete object, soon after, you send to a method that will register this in session using session_start in php.

With jQuery you would have to mount a file that was received via post, then you would use ajax and send it by post, but in this second case also using session to not lose what has been included.

I'll try to create an example as soon as I get to the computer and send you this post.

    
10.05.2017 / 14:15