IE Ajax Bug: "The data necessary to complete this operation is not yet available"
Using IE6, when a .load() is called and a timeout handler occurs
before the response is received, an error occurs in IE in this line
(jQuery 1.2.3) in the "complete" method of the jQuery.ajax call:
self.each( callback, [res.responseText, status, res] );
At this point, the 'res' object exists and has a responseText
attribute, but reading this attribute causes the exception:
"The data necessary to complete this operation is not yet available"
In IE, the typeof res.responseText will be "unknown" at this point, so
to avoid the problem I recommend this change:
self.each( callback, [(typeof res.responseText=="unknown"?
null:res.responseText), status, res] );
An old ticket exists reporting the same error:
http://dev.jquery.com/ticket/1088
But it was dismissed simply as "worksforme".
Here is the simplest test case that I could create that shows the
error:
$.ajaxSetup({timeout : 1});
$(function(){ $('body').load('delay.php'); });
where "delay.php" is something that just delays for a few seconds.
Actually even if it's a non-existant file, the error still fires for
me.
I have found no simple work-around other than overriding the built-in
load function and putting the fix into my local version.
Matt Kruse