From f5f655bd7a0980fed59cdb4e445114ee7747c5e5 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 24 Mar 2012 16:35:18 +1300 Subject: [PATCH] BUGFIX: Show a correct growl message when ajax returns a JS error rather than HTTP error. --- admin/javascript/LeftAndMain.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 340978ff1..2fb797a6d 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -23,7 +23,11 @@ jQuery.noConflict(); // global ajax error handlers $.ajaxSetup({ error: function(xmlhttp, status, error) { - var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText; + if(xmlhttp.status < 200 || xmlhttp.status > 399) { + var msg = (xmlhttp.getResponseHeader('X-Status')) ? xmlhttp.getResponseHeader('X-Status') : xmlhttp.statusText; + } else { + msg = error; + } statusMessage(msg, 'bad'); } });