Symfony DataTables return database in ajax.text format

  ajax, datatables, php, symfony

I’m using DataTables in my symfony project to render a table with database info like this:


                        {% for file in files %}

                                <td>{{ }}</td>
                                <td>{{ file.primaryCat }}</td>
                                <td>{{ file.secondaryCat }}</td>
                                <td>{{ file.postedAt}}</td>
                                <td>{{ file.tags }}</td>
                                <td>{{ file.location }}</td>
                                <td>{{ file.language }}</td>
                                    {% if app.user.username == %}
                                        <div class="dropdown mb-4">
                                            <button class="btn btn-warning " type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            <div class="dropdown-menu animated--fade-in" aria-labelledby="dropdownMenuButton">
                                                <a class="dropdown-item" href="#">Action</a>
                                                <a class="dropdown-item" href="#">Another action</a>
                                                <a class="dropdown-item" href="#">Something else here</a>
                                    {% endif %}
                                    <a class="btn btn-info" href="/uploads/{{ file.path }}" target="_blank">View</a>
                                    <a class="btn btn-primary" href="/uploads/{{ file.path }}" download="">Download</a>


                        {% endfor %}


Everything works well but I’d like to implement this exemple :

Now I don’t know much about ajax, is there a way to go around without ajax or how should I get my data from the database into a file like : objects.txt shown in the exemple

Source: Symfony Questions