1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| {% extends 'ImmobilierSwitchHomeBundle::layout.html.twig'%}
{% block content%}
<form id="form_recherche" action = "{{path('immobilier_deal_rechercher')}}" method="post" >
<table summary="Recherche rapide">
<caption>Recherche rapide</caption>
<tfoot>
<tr><th scope="row" colspan =4><input type="submit" value="Rechercher"/></th></tr>
</tfoot>
<tbody>
<tr>
<th scope="col" colspan =4>{{form_label(form.motcle)}}</th>
<th scope="row" colspan =4>
{{form_errors(form.motcle)}}
{{form_widget(form.motcle)}}
</th>
</tr>
{{ form_rest(form)}}
</tbody>
</table>
</form>
<div class="loading"></div>
<div id="resultats_recherche">
{% include 'ImmobilierSwitchHomeBundle:Deal:listDeal.html.twig' with {'deals' : deals} %}
</div>
<script>
$(".loading").hide();
$("#form_recherche").submit(function(){
$(".loading").show();
var motcle = $("#dealrecherche_motcle").val();
var DATA = 'motcle=' + motcle;
$.ajax({
type: "POST",
url: "{{ path('immobilier_deal_rechercher')}}",
data: DATA,
cache: false,
success: function(data){
alert("success");
$('#resultats_recherche').html(data);
$(".loading").hide();
},
error: function(){
alert("error");
}
});
return false;
});
</script>
{% endblock %} |
Partager