0

I'm working with twig for render data. Here is my code:

function addProduct(product_id, product_image, product_name) {
        product_ids.push(parseInt(product_id));
        // console.log(file_id);

        $.each(product_ids, function (i, val) {
            products[i]= {id: product_id, image: product_image, name: product_name};
        })
        console.log(products);
        $("#search-pop").slideUp();
        $(".list-selected-product").append(
            {% include '_layout/include/_render_product_select.html.twig' with {'products': products} %}
        );
        // console.log($(".list-selected-product").html(products));
    }

Now i want to render_product_select but i don't know how can transmission products to this. Please help me! Thank so much.

zunkt
  • 1
  • 1
  • Does this answer your question? [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – DarkBee Jan 18 '21 at 10:24
  • You'll need to send the (javascript) variable `products` back to the server with `ajax` and render the template from there as javascript can't interact with twig. See question above – DarkBee Jan 18 '21 at 10:25

0 Answers0