Main menu

fix An HTTP error 0 occurred when autocomplete is interrupted by form submit

30 Jul
Published by Mark W. Breneman

Or at least make the error not pop up a javascript alert.

autocomplete.js pipes all errors to a javascript alerts even simple ajax did not complete, because YOU hit the button too quickly messages. In my case, I did not want a user to see the error message just because they clicked the search button before the auto suggest did its thing. So after a bit of research via google and a tip a coworker gave me, I found that a simple tweak to the autocomplete.js to redirect the alerts to the firebug console was a good solution.

around line 284 in /misc/autocomplete.js (Drupal 6)

error: function (xmlhttp) {
alert(Drupal.ahahError(xmlhttp, db.uri));
}
});

to

error: function (xmlhttp) {
console.log(Drupal.ahahError(xmlhttp, db.uri));
}
});

Other notes:
http://drupal.org/node/627834

Category 

Drupal

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.