{% extends 'partials/base.html.twig' %} {% block content %} <div class="header-wrapper"> {% if header.entete.text == true %} <div class="entete"> <div class="entete_c"> <p>{{ header.entete.text }}</p> </div> </div> {% endif %} </div> {% include "forms/form.html.twig" %} <div id="form-result"></div> <script> $(document).ready(function(){ var form = $('#ajax-test-form'); form.submit(function(e) { // prevent form submission e.preventDefault(); // submit the form via Ajax $.ajax({ url: form.attr('action'), type: form.attr('method'), dataType: 'html', data: form.serialize(), success: function(result) { // Inject the result in the HTML $('#form-result').html(result); } }); }); }); </script> {% endblock %}