diff options
-rw-r--r-- | phpBB/assets/javascript/core.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index 9eb931270a..9182d70473 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -262,8 +262,15 @@ phpbb.ajaxify = function(options) { console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); } phpbb.clearLoadingTimeout(); - var errorText = false; - if (typeof errorThrown === 'string' && errorThrown.length > 0) { + var responseText, errorText = false; + try { + responseText = JSON.parse(jqXHR.responseText); + responseText = responseText.message; + } catch (e) {} + if (typeof responseText === 'string' && responseText.length > 0) { + errorText = responseText; + } + else if (typeof errorThrown === 'string' && errorThrown.length > 0) { errorText = errorThrown; } else { |