modifié : SRC/public/js/ListeOeuvre.js

This commit is contained in:
sidya82 2015-03-03 12:24:43 +01:00
parent 3a980e247b
commit caed3d7972
1 changed files with 13 additions and 11 deletions

View File

@ -5,23 +5,25 @@ $('.listeoeuvre').click(function(event) {
$(this).addClass("active"); $(this).addClass("active");
$('#oeuvrePic').empty(); $('#oeuvrePic').empty();
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val(); url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
var r = new XMLHttpRequest();
var req = new XMLHttpRequest(); r.open("GET", url, true);
req.onload = function(e) { r.onreadystatechange = function () {
var data = req.reponse; if (r.readyState != 4 || r.status != 200)
return;
var data = JSON.parse(r.response);
if (data.length == 0 ) if (data.length == 0 )
$("#oeuvrePic").append("Aucune Oeuvre"); $("#oeuvrePic").append("Aucune Oeuvre");
data.forEach( function(el) { for (el in data)
{
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">' $("#oeuvrePic").append('<div class="col-xs-4 col-md-3">'
+'<a href="#" class="thumbnail">' +'<a href="#" class="thumbnail">'
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>' +'<img src="http://www.augustins.org/documents/10180/156407/' + data[el].urlPhoto + '"/>'
+'</a></div>'); +'</a></div>');
}); }
req.open('GET', url, true); };
req.send(); r.send();
}); });