mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
commit
06a4e1aad6
@ -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');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user