ajax
This commit is contained in:
parent
61f4439942
commit
3a980e247b
@ -5,27 +5,24 @@ $('.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();
|
||||||
$.get(url, function( data ) {
|
|
||||||
|
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
req.onload = function(e) {
|
||||||
|
var data = req.reponse;
|
||||||
if (data.length == 0 )
|
if (data.length == 0 )
|
||||||
|
|
||||||
$("#oeuvrePic").append("Aucune Oeuvre");
|
$("#oeuvrePic").append("Aucune Oeuvre");
|
||||||
data.forEach( function(el) {
|
data.forEach( function(el) {
|
||||||
$("#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/' + el.urlPhoto + '"/>'
|
||||||
+'</a></div>');
|
+'</a></div>');
|
||||||
})
|
|
||||||
}, "json" )
|
|
||||||
|
|
||||||
.fail(function() {
|
|
||||||
$("#oeuvrePic").append('<div class="alert alert-danger">'
|
|
||||||
+'<strong>Oouups!</strong> Il y a un problème.<br><br>'
|
|
||||||
+'<ul>'
|
|
||||||
+'<li>Erreur lors de la récupération</li>'
|
|
||||||
+'</ul>'
|
|
||||||
+'</div>'
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
req.open('GET', url, true);
|
||||||
|
req.send();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user