1

I have a problem with my Symfony2 Website. I have a search function which work fine in production but not in wamp.

My twig file :

{% extends "::base.html.twig" %}

{% block title %}Membres en attente de validation{% endblock %}

{% block body %}

{% if confirmation != null %}<div id="confirmationValidation">Nouveau tutoré accepté : {{ confirmation }}</div>{% endif %}

<form id="form_recherche_validation" action="{{ path('paces_user_validation_recherche') }}" method="post">
    {{ form_widget(form) }}
    <input type="submit" value="Rechercher" />
</form>

    <!-- Loading -->
    <div class="center-align">
        <div class="preloader-wrapper small active loading_validation">
        </div>
    </div>

<div id="resultats_recherche_validation">
    {% include 'PACESUserBundle:Validation:liste.html.twig' with {'tutores' : tutores} %}
</div>

{% endblock %}

Problem is that search is working thanks to a script :

$(".loading_validation").hide();
$("#resultats_recherche_validation").hide();
$("#form_recherche_validation").submit(function() {
    $(".loading_validation").show();
    $("#resultats_recherche_validation").show();
    var numero = $("#paces_user_validationRechercheForm_numero").val();
    var nom = $("#paces_user_validationRechercheForm_nom").val();
    var prenom = $("#paces_user_validationRechercheForm_prenom").val();
    var DATA = {numero: numero, nom: nom, prenom: prenom};
    var request = $.ajax({
        type: "POST",
        url: "{{ path('paces_user_validation_recherche')}}",
        data: DATA,
        success: function(data) {
            $('#resultats_recherche_validation').html(data);
            $(".loading_validation").hide();
        }
    });
    return false;
});

This script is normally loaded in the page's twig file. In wamp, all scripts doesn't work except those I put in my base.html.twig. So I created a custom.js file which loads the scripts for the whole website.

According to Chrome developer tools, it should be a route problem :

No route found for "POST /validation/%7B%7B%20path('paces_user_validation_recherche')%7D%7D" (from "http://localhost/trunk/web/validation/")

I searched for a whole day but I don't find an answer. Do you have an idea ?

Kristen Joseph-Delaffon
  • 1,261
  • 2
  • 17
  • 37
  • 1
    You need to create a Virtual Hosts so your site has a correct DocumentRoot set. [See this post to setup a VHOST in wampserver](http://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618) – RiggsFolly Jul 26 '15 at 19:02
  • This is working well. Thank you very much ! And do you have an idea about my script problem ? Why scripts on specific page don't work and why I have to put all the scripts in an external file ? – Kristen Joseph-Delaffon Jul 27 '15 at 08:13
  • You should not, and should not need to change anything to make the site run on the testing environment. If you do its not a valid test. I have no idea what this `path('paces_user_validation_recherche')` does so cannot help you – RiggsFolly Jul 27 '15 at 09:17
  • It's not what I meant. If I put a script whatever it is in a page.html.twig, it doesn't work. If I put the same script in my custom.js which is loaded in my base.html.twig, it works. – Kristen Joseph-Delaffon Jul 27 '15 at 13:02
  • Sorry not a TWIG user. But it sounds like you may have some config missing or wrong! – RiggsFolly Jul 27 '15 at 13:11

0 Answers0