Modification du script

This commit is contained in:
Michael RICOIS 2015-04-08 13:47:33 +00:00
parent f1ea90fb00
commit 1fefbb8fb8

View File

@ -13,22 +13,19 @@ $(document).ready(function(){
}
});
$("a.update").click(function(e){
$('a.update').click(function(e){
e.preventDefault();
var href = $(this).attr('href');
var $firstHTML = '<tr id="ligneUpdate"><td colspan="3" align="center"><img src="/themes/default/images/ajax.gif"/></td></tr>';
$('table.comptages').prepend($firstHTML);
$.getJSON(href, function(data, status){
if (status=='success') {
$('tr#ligneUpdate').html(
'<td>'+data.dateAjout+'</td>' +
'<td>'+data.resultat+'</td>' +
'<td>'+data.uniteInsee+'</td>'
);
} else {
$('tr#ligneUpdate').html('<td colspan="3" align="center">Une erreur est survenue.</td>');
}
var $firstHTML = '<tr id="ligne-update"><td colspan="3" align="center">Calcul en cours ...</td></tr>';
$('table.comptage').prepend($firstHTML);
$.getJSON(href, function(data) {
$('tr#ligne-update').html(
'<td>'+data.dateAjout+'</td>' +
'<td>'+data.resultat+'</td>' +
'<td>'+data.uniteInsee+'</td>'
);
}).fail(function(){
$('tr#ligne-update').html('<td colspan="3" align="center">Une erreur est survenue.</td>');
});
});
@ -38,7 +35,7 @@ $(document).ready(function(){
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
width: 550,
height: 400,
modal: true,
open: function(event, ui) {
@ -52,15 +49,6 @@ $(document).ready(function(){
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
});
$('[data-load-remote]').on('click',function(e) {
$('button.submit').prop('disabled', true);
e.preventDefault();
var $this = $(this);
var remote = $this.data('load-remote');
if(remote) {
$($this.data('remote-target')).load(remote);
}
});
});
});