JavaScript: Failed, solved

This error was bugging me for about 2 days, so I though I would post this to a) help me remember to code properly and b) help someone else solve it in the unlikely situation of it happening elsewhere.

Basically, in IE8 and IE8 only, I was getting a helpful error message that said: line 1421 in jquery.js: Failed. Line 1421 was because I had uncompressed jQuery to try and find the problem.

The only other example of this error I could find (also found by Kenneth) was this instance: When jQuery returns “failed” in IE – and how it’s probably resolved which while it helped a bit, we weren’t using any live events.

So to the issue, after much troubleshooting and major investigation work, we resolved that in the (not sure if these are core within Drupal) Drupal installation, jQuery 1.2.6 was used with an old version of jquery.forms.js. We found that some of the forms plugin called methods that only came into jQuery in 1.3 (namely closest() ). Calling these non-existant methods caused the javascript error “Failed”.

The absurdly easy solution following hours of troubleshooting, was upgrade both jquery.js and jquery.forms.js to the latest versions. Bosh. Have that IE8.

So the moral of this story is ALWAYS KEEP YOUR LIBRARIES AND PLUGINS UP TO DATE!! And if you get the IE8 “Failed” javascript error, make sure you are calling methods that exist.

5 thoughts on “JavaScript: Failed, solved”

  1. I’d check your plug ins, one by one, don’t include them and see if the error still happens – and then I would take every single line and make sure there wasn’t an extra comment somewhere. This is more likely if your application seems fine in Firefox or Chrome etc, but fails in IE.

  2. I’m using the jQuery (v1.4.4) but I change the jQuery(1.5.2) also have the error :SCRIPT16389: Failed
    and the error cause swfupload can’t work!

Leave a Reply

Your email address will not be published. Required fields are marked *