From 31b5e76cbee2c1e834110f22a41a3b5832898203 Mon Sep 17 00:00:00 2001 From: sidya82 Date: Mon, 2 Mar 2015 11:55:04 +0100 Subject: [PATCH] =?UTF-8?q?=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20SRC/public/js/ListeOeuvre.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SRC/public/js/ListeOeuvre.js | 55 +++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/SRC/public/js/ListeOeuvre.js b/SRC/public/js/ListeOeuvre.js index 6f8006b..e402692 100755 --- a/SRC/public/js/ListeOeuvre.js +++ b/SRC/public/js/ListeOeuvre.js @@ -79,20 +79,32 @@ $('#search_button, #previous, #next').click(function(event) { } $('#oeuvreRes').empty(); - dataSend = { - _token : $('#_tokenRes').val(), - auteur: $('#auteur').val(), - designation: $('#designation').val(), - matiere: $('#matiere').val(), - domaine: $('#domaine').val(), - technique: $('#technique').val(), - debut: $('#debut').val(), - fin: $('#fin').val() - }; - $.post(url, - dataSend, - function( data ) { - if (data.length == 0 ) + dataSend = "_token = $('#_tokenRes').val()," + +"auteur = ('#auteur').val()," + +"designation = $('#designation').val()," + +"matiere = $('#matiere').val()," + +"domaine = $('#domaine').val()," + +"technique = $('#technique').val()," + +"debut = $('#debut').val()," + +"fin = $('#fin').val()"; + + var r = new XMLHttpRequest(); + r.open("POST", url, true); + r.onreadystatechange = function () { + if (r.readyState != 4 || r.status != 200) + { + $("#oeuvreRes").append('
' + +'Oouups! Il y a un problème.

' + +'' + +'
' + ); + + return; + } + data = r.responseText; + if (data.length == 0 ) $("#oeuvreRes").append("Aucune Oeuvre Trouvé.."); data.data.forEach( function(el) { $("#oeuvreRes").append('
' @@ -114,18 +126,9 @@ $('#search_button, #previous, #next').click(function(event) { $("#next").attr('href', data.next_page_url); $("#next").parent().removeClass('disabled'); } - - }, "json" ) - - .fail(function() { - $("#oeuvreRes").append('
' - +'Oouups! Il y a un problème.

' - +'
    ' - +'
  • Erreur lors de la récupération
  • ' - +'
' - +'
' - ); - }); + + }; + r.send(dataSend); });