发生此错误是因为它是在Drupal中处理AJAX错误的标准方法。如果您提交表单,而AJAX请求正在处理,您将收到错误。
这个错误实际上是Drupal和Drupal的预期目的是通过Drupal.ajax.prototype.error = function (response, uri)
结合Drupal.ajaxError = function (xmlhttp, uri)
在Drupal 7的misc/drupal.js
文件中引发此错误。
请注意,这是比问题更多的UX问题。
上有用于固定它的Drupal 8
为Drupal 7关于Drupal alerts "An AJAX HTTP request terminated abnormally" during normal site operation, confusing site visitors/editors Drupal站点悬而未决的问题,你可以尝试应用以下核心补丁:D7-fix_autocomplete_terminated_error-1232416-179-do-not-test.patch出外:
--- a/misc/ajax.js
+++ b/misc/ajax.js
@@ -448,7 +448,10 @@ Drupal.ajax.prototype.getEffect = function (response) {
* Handler for the form redirection error.
*/
Drupal.ajax.prototype.error = function (response, uri) {
- alert(Drupal.ajaxError(response, uri));
+ // Fix for autocomplete terminated error.
+ if (response.status != 0) {
+ alert(Drupal.ajaxError(response, uri));
+ }
// Remove the progress element.
if (this.progress.element) {
$(this.progress.element).remove();
diff --git a/misc/autocomplete.js b/misc/autocomplete.js
index 8f7ac60..980c1ca 100644
--- a/misc/autocomplete.js
+++ b/misc/autocomplete.js
@@ -306,7 +306,10 @@ Drupal.ACDB.prototype.search = function (searchString) {
}
},
error: function (xmlhttp) {
- alert(Drupal.ajaxError(xmlhttp, db.uri));
+ // Fix for autocomplete terminated error.
+ if (xmlhttp.status != 0) {
+ alert(Drupal.ajaxError(xmlhttp, db.uri));
+ }
}
});
}, this.delay);
这是因为ajax请求没有完成,并且用户请求了新的页面! –