added a ajax error handler.

sometimes errors occur on the client side. because of the
ajax.complete() callback is not fired the loading indicator does not
disappear and the ui feels like the request runs endless, even if it
already terminated with an error.
This commit is contained in:
Markus Staab
2013-06-25 12:37:03 +02:00
parent 5d057d742a
commit fe621cd8ee
+6
View File
@@ -75,6 +75,11 @@
refreshKrumoState(); refreshKrumoState();
}); });
}; };
handleAjaxError = function(event, jqxhr, settings, exception) {
$('div.output').html("<em>Error occured while posting your code.</em>");
refreshKrumoState();
};
initializeAce = function() { initializeAce = function() {
var PhpMode, code; var PhpMode, code;
@@ -120,6 +125,7 @@
$(function() { $(function() {
$(document).ready(initializeAce); $(document).ready(initializeAce);
$(document).ajaxError(handleAjaxError);
$('form').submit(handleSubmit); $('form').submit(handleSubmit);
}); });