首页 > 解决方案 > 使用 jQuery 将变量移动到另一个 html 并加载它

问题描述

我正在使用 twig 来获取渲染数据。这是我的代码:

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));
    }

现在我想 render_product_select 但我不知道如何将产品传输到此。请帮我!非常感谢。

标签: twigsymfony4

解决方案


推荐阅读