diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-05-30 11:33:48 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-05-30 11:33:48 +0200 |
commit | df4b391baadd3b9194062a4907ef4b55b265ffab (patch) | |
tree | 756d2ea974eb1447b0ba0054f40140ab8af94291 | |
parent | 01073ffcbf6ecff50071018e2eaaae9cd81fcbbc (diff) | |
parent | c7a0b4479d2e4cfeefbfd951e499fc20da4051c4 (diff) | |
download | forums-df4b391baadd3b9194062a4907ef4b55b265ffab.tar forums-df4b391baadd3b9194062a4907ef4b55b265ffab.tar.gz forums-df4b391baadd3b9194062a4907ef4b55b265ffab.tar.bz2 forums-df4b391baadd3b9194062a4907ef4b55b265ffab.tar.xz forums-df4b391baadd3b9194062a4907ef4b55b265ffab.zip |
Merge pull request #3545 from VSEphpbb/ticket/13771
[ticket/13771] Allow AJAX errors to support exceptions messages
-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 { |