From f0fe73e8b00ff2e928f9af6bdd13d853713fa730 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Wed, 18 May 2011 14:18:41 +0200 Subject: [PATCH] Errors display on ajax requests. fixed #138 --- static/js/common.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/static/js/common.js b/static/js/common.js index 558736e24..b697a0b5d 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -58,13 +58,21 @@ function check_anchor() { profile: current_anchor.loading_color, spinner: true }); - new Request.JSON({url: query, noCache : true, onSuccess: function(resp) { - var callback = ($defined(resp.callback)) ? resp.callback : "default"; - callbacks[callback](resp); - infobox.info(gettext("Done")); - infobox.hide(1); - current_anchor.reset_loading_infos(); - }}).get(); + new Request.JSON({ + url: query, + noCache : true, + onSuccess: function(resp) { + var callback = ($defined(resp.callback)) ? resp.callback : "default"; + callbacks[callback](resp); + infobox.info(gettext("Done")); + infobox.hide(1); + current_anchor.reset_loading_infos(); + }, + onFailure: function(xhr) { + $(document.body).set("html", xhr.responseText); + $(document.body).setStyle("overflow", "auto"); + } + }).get(); }; /*