• Как сделать данный запрос ajax в Symfony?

    maximus272
    @maximus272 Автор вопроса
    БГУИР второй курс прогер
    А вот как обрабатывает html.twig полученные из php

    <div class="products">
                    <div class="title-bar">
                        <h1>Каталог продукции</h1>
                        <h2>{% if count is defined %}{{count}}{% endif %} товаров</h2>
                    </div>
                    
                     {% if resPowerProm is defined %}
                    {% for fixture in resPowerProm %}
                    <a href="/symfony/web/fixtures/prom/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if resPowerOffice is defined %}
                    {% for fixture in resPowerOffice %}
                    <a href="/symfony/web/fixtures/office/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if resPowerTorg is defined %}
                    {% for fixture in resPowerTorg %}
                    <a href="/symfony/web/fixtures/torg/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if resPowerStreet is defined %}
                    {% for fixture in resPowerStreet %}
                    <a href="/symfony/web/fixtures/street/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if resPowerFito is defined %}
                    {% for fixture in resPowerFito %}
                    <a href="/symfony/web/fixtures/fito/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if resPowerAzs is defined %}
                    {% for fixture in resPowerAzs %}
                    <a href="/symfony/web/fixtures/azs/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if promfixtures is defined %}
                    {% for fixture in promfixtures %}
                    <a href="/symfony/web/fixtures/prom/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif%}
                    
                    {% if officefixtures is defined %}
                    {% for fixture in officefixtures %}
                    <a href="/symfony/web/fixtures/office/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif %}
                    
                    {% if torgfixtures is defined %}
                    {% for fixture in torgfixtures %}
                    <a href="/symfony/web/fixtures/torg/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif %}
                    
                    {% if streetfixtures is defined %}
                    {% for fixture in streetfixtures %}
                    <a href="/symfony/web/fixtures/street/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif %}
                    
                    {% if fitofixtures is defined %}
                    {% for fixture in fitofixtures %}
                    <a href="/symfony/web/fixtures/fito/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif %}
                    
                    {% if azsfixtures is defined %}
                    {% for fixture in azsfixtures %}
                    <a href="/symfony/web/fixtures/azs/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif %}
                    
                    {% if resProm is defined %}
                    {% for fixture in resProm %}
                    <a href="/symfony/web/fixtures/prom/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %}
                    {% endif %}
                   
                    {% if resTorg is defined %}
                        {% for fixture in resTorg %}
                    <a href="/symfony/web/fixtures/torg/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %} 
                    {% endif %}    
                    
                     {% if resOffice is defined %}
                        {% for fixture in resOffice %}
                    <a href="/symfony/web/fixtures/office/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %} 
                    {% endif %}
                    
                     {% if resStreet is defined %}
                        {% for fixture in resStreet %}
                    <a href="/symfony/web/fixtures/street/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %} 
                    {% endif %}
                    
                     {% if resFito is defined %}
                        {% for fixture in resFito %}
                    <a href="/symfony/web/fixtures/fito/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %} 
                    {% endif %}
                    
                     {% if resAzs is defined %}
                        {% for fixture in resAzs %}
                    <a href="/symfony/web/fixtures/azs/{{fixture.id}}"><div class="products_item">
                            <div class="products_item_bg" style="background: url({{fixture.picture}}); background-size: cover"></div>
                            <h1>{{fixture.name}}</h1>
                            <p>{{fixture.shortDesc|raw}}</p>
                        </div></a>
                    {% endfor %} 
                    {% endif %}
    
                </div>
    Ответ написан
    Комментировать