Small improvements in AJAX errors
authorThierry Florac <thierry.florac@onf.fr>
Mon, 04 Jun 2018 16:01:03 +0200
changeset 332 13c5ac0603dd
parent 331 a473eb11ed15
child 333 998612eb81d7
Small improvements in AJAX errors
src/pyams_skin/resources/js/myams.js
--- a/src/pyams_skin/resources/js/myams.js	Wed May 30 15:05:59 2018 +0200
+++ b/src/pyams_skin/resources/js/myams.js	Mon Jun 04 16:01:03 2018 +0200
@@ -825,7 +825,7 @@
 			if (response.contentType === 'json') {
 				ams.ajax.handleJSON(response.data);
 			} else {
-				var title = event.statusText || event.type;
+				var title = error || event.statusText || event.type;
 				var message = response.responseText;
 				ams.skin.messageBox('error', {
 					title: ams.i18n.ERROR_OCCURED,
@@ -2640,7 +2640,10 @@
 							} else {
 								target.empty();
 							}
-						});
+						})
+					.fail(function() {
+						target.empty();
+					});
 					break;
 				case 'json-rpc':
 					target.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');