BUGFIX: Show a correct growl message when ajax returns a JS error rather than HTTP error.

This commit is contained in:
Sam Minnee 2012-03-24 16:35:18 +13:00
parent 06dd79f34c
commit f5f655bd7a

View File

@ -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');
}
});