Created
April 13, 2015 15:14
-
-
Save rgkimball/cc92980dad3af6e4f844 to your computer and use it in GitHub Desktop.
Prevents Drupal from throwing alert()s when AJAX is interrupted.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
preventAlerts: function () { | |
//Copy drupal's original error function for later use if you want | |
Drupal.ajax.prototype.original_error = Drupal.ajax.prototype.error; | |
Drupal.ajax.prototype.error = function (response, uri) { | |
// This should catch the "terminated abnormally" error | |
if (response.readyState == 0 || response.readyState == 4) { | |
console.log(response); | |
} | |
else { | |
this.original_error(response, uri); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment