This commit is contained in:
DonRenando 2015-03-02 11:56:42 +01:00
commit 4404a1a488
1 changed files with 29 additions and 26 deletions

View File

@ -79,20 +79,32 @@ $('#search_button, #previous, #next').click(function(event) {
} }
$('#oeuvreRes').empty(); $('#oeuvreRes').empty();
dataSend = { dataSend = "_token = $('#_tokenRes').val(),"
_token : $('#_tokenRes').val(), +"auteur = ('#auteur').val(),"
auteur: $('#auteur').val(), +"designation = $('#designation').val(),"
designation: $('#designation').val(), +"matiere = $('#matiere').val(),"
matiere: $('#matiere').val(), +"domaine = $('#domaine').val(),"
domaine: $('#domaine').val(), +"technique = $('#technique').val(),"
technique: $('#technique').val(), +"debut = $('#debut').val(),"
debut: $('#debut').val(), +"fin = $('#fin').val()";
fin: $('#fin').val()
}; var r = new XMLHttpRequest();
$.post(url, r.open("POST", url, true);
dataSend, r.onreadystatechange = function () {
function( data ) { if (r.readyState != 4 || r.status != 200)
if (data.length == 0 ) {
$("#oeuvreRes").append('<div class="alert alert-danger">'
+'<strong>Oouups!</strong> Il y a un problème.<br><br>'
+'<ul>'
+'<li>Erreur lors de la récupération</li>'
+'</ul>'
+'</div>'
);
return;
}
data = r.responseText;
if (data.length == 0 )
$("#oeuvreRes").append("Aucune Oeuvre Trouvé.."); $("#oeuvreRes").append("Aucune Oeuvre Trouvé..");
data.data.forEach( function(el) { data.data.forEach( function(el) {
$("#oeuvreRes").append('<div class="col-xs-4 col-md-3">' $("#oeuvreRes").append('<div class="col-xs-4 col-md-3">'
@ -114,18 +126,9 @@ $('#search_button, #previous, #next').click(function(event) {
$("#next").attr('href', data.next_page_url); $("#next").attr('href', data.next_page_url);
$("#next").parent().removeClass('disabled'); $("#next").parent().removeClass('disabled');
} }
}, "json" ) };
r.send(dataSend);
.fail(function() {
$("#oeuvreRes").append('<div class="alert alert-danger">'
+'<strong>Oouups!</strong> Il y a un problème.<br><br>'
+'<ul>'
+'<li>Erreur lors de la récupération</li>'
+'</ul>'
+'</div>'
);
});
}); });