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");
$('#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('<div class="col-xs-4 col-md-3">'
+'<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>');
});
req.open('GET', url, true);
req.send();
}
};
r.send();
});