error function not triggered when using $.ajax() to load an external script

error function not triggered when using $.ajax() to load an external script

Hi,

I'm using $.ajax() to load an external script, to get the latest updates from a twitter user. I'm using this so that Twitter downtime doesn't affect my site, because if I hardcode this in the HTML, my document.ready function halts or errors if/while twitter is down.

The problem is I can't get the error function to trigger when the loading fails. This is what I'm using:
  1. $.ajax({
  2.    url: twitter_url ,
  3.    timeout: 20000,
  4.    dataType: 'script',
  5.    success: twitter_LoadSuccess,
  6.    error: twitter_LoadError,
  7.    complete: twitter_LoadComplete
  8. });
Both "twitter_LoadSuccess" and "twitter_LoadComplete" are executed, but twitter_LoadError never gets triggered, even when the script is not loaded.

Any idea why?

Thanks