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

This commit is contained in:
sidya82 2015-02-19 18:44:40 +01:00
parent b54fd5e95f
commit 4fac5f8726
1 changed files with 50 additions and 49 deletions

View File

@ -1,55 +1,56 @@
$(document).ready( function() {
console.log( "document loaded" );
$('.listeoeuvre').click(function() {
$('#oeuvrePic').empty();
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
$.get(url, function( data ) {
if (data.length == 0 )
$("#oeuvrePic").append("Aucune Oeuvre");
data.forEach( function(el) {
$("#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 + '"/>'
+'</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>'
);
});
});
$('.listeoeuvre').click(function() {
$('#oeuvrePic').empty();
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
$.post(url,
dataSend,
function( data ) {
}, "json" )
.done(function() {
$("#oeuvrePic").append('<div class="alert alert-sucess">'
+'<ul>'
+'<li>Sauvegarde valider</li>'
+'</ul>'
+'</div>'
//Selection d'une recherche d'oeuvre
$('.listeoeuvre').click(function() {
$('#oeuvrePic').empty();
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
$.get(url, function( data ) {
if (data.length == 0 )
$("#oeuvrePic").append("Aucune Oeuvre");
data.forEach( function(el) {
$("#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 + '"/>'
+'</a></div>');
})
.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>'
);
});
}, "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>'
);
});
});
//Enregistrement d'une liste d'ouevre
$('#enregistrer').click(function() {
url = "/setListOeuvres/" + $(this).children('.idListeOeuvre').val();
dataSend = { idListeOeuvre : 1,
oeuvres : "1-2-3-4"};
$.post(url,
dataSend,
function( data ) {
;
})
.done(function() {
$("#oeuvrePic").append('<div class="alert alert-sucess">'
+'<ul>'
+'<li>Sauvegarde validée</li>'
+'</ul>'
+'</div>');
})
.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 l\'envoie</li>'
+'</ul>'
+'</div>');
});
});