diff --git a/js/gamutable.js b/js/gamutable.js index c984d76..89bb230 100644 --- a/js/gamutable.js +++ b/js/gamutable.js @@ -48,26 +48,26 @@ jQuery(function () { dataType: 'json', async: true }).done(function (retour) { - if (parseInt(id) > 0) { - app.rechargerJson(id); - app.rechargerJson_deux(id); - } else { - app.rechargerJson(); - app.rechargerJson_deux(); - } - - if (nomBlocAjaxReload !== undefined) { - console.log('depart reload: ' + nomBlocAjaxReload); - ajaxReload(nomBlocAjaxReload, { - args: { - id: id - }, - callback: function callback() {} - }); - } - - if (Array.isArray(retour) && retour.message_erreur !== undefined) { + if (!$.isEmptyObject(retour) && !$.isEmptyObject(retour.message_erreur)) { alert(retour.message_erreur); + } else { + if (parseInt(id) > 0) { + app.rechargerJson(id); + app.rechargerJson_deux(id); + } else { + app.rechargerJson(); + app.rechargerJson_deux(); + } + + if (nomBlocAjaxReload !== undefined) { + console.log('depart reload: ' + nomBlocAjaxReload); + ajaxReload(nomBlocAjaxReload, { + args: { + id: id + }, + callback: function callback() {} + }); + } } }); }); // lancement d'une modalbox