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.

' - +'' - +'
' - ); - }); + + }; + r.send(dataSend); });