Merge pull request #268 from sminnee/raise-js-errors

BUGFIX: Show a correct growl message when ajax returns a JS error rather than HTTP error.
This commit is contained in:
Ingo Schommer 2012-03-26 06:27:41 -07:00
commit 06a4e1aad6

View File

@ -23,7 +23,11 @@ jQuery.noConflict();
// global ajax error handlers // global ajax error handlers
$.ajaxSetup({ $.ajaxSetup({
error: function(xmlhttp, status, error) { 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'); statusMessage(msg, 'bad');
} }
}); });