diff --git a/SRC/public/js/ListeOeuvre.js b/SRC/public/js/ListeOeuvre.js index ecfc365..631224d 100755 --- a/SRC/public/js/ListeOeuvre.js +++ b/SRC/public/js/ListeOeuvre.js @@ -5,23 +5,25 @@ $('.listeoeuvre').click(function(event) { $(this).addClass("active"); $('#oeuvrePic').empty(); url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val(); + - - var req = new XMLHttpRequest(); - req.onload = function(e) { - var data = req.reponse; + var r = new XMLHttpRequest(); + r.open("GET", url, true); + r.onreadystatechange = function () { + if (r.readyState != 4 || r.status != 200) + return; + var data = JSON.parse(r.response); if (data.length == 0 ) - $("#oeuvrePic").append("Aucune Oeuvre"); - data.forEach( function(el) { + for (el in data) + { $("#oeuvrePic").append('
' +'' - +'' + +'' +'
'); - }); - req.open('GET', url, true); - req.send(); - + } + }; + r.send(); });