From 6d22dae608d547aa84e3cd00d6ea2a62fd2db76e Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Sun, 13 Jan 2013 23:42:54 +0000 Subject: [PATCH] If AJAX call was cancelled, because user navigated to a different page, error callbacks are not invoked. --- .../src/main/webapp/js/gemp-015/communication.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js index df87b45ed..2c8fd8dbf 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-015/communication.js @@ -10,11 +10,13 @@ var GempLotrCommunication = Class.extend({ errorCheck:function (errorMap) { var that = this; return function (xhr, status, request) { - var errorStatus = "" + xhr.status; - if (errorMap != null && errorMap[errorStatus] != null) - errorMap[errorStatus](xhr, status, request); - else - that.failure(xhr, status, request); + if (xhr.getAllResponseHeaders()) { + var errorStatus = "" + xhr.status; + if (errorMap != null && errorMap[errorStatus] != null) + errorMap[errorStatus](xhr, status, request); + else + that.failure(xhr, status, request); + } }; },