NerdyHearn
Home
Blog

Contact
Mailing List

Software

Active Directory Products
Object Compare
Permission Compare

IPhone Products
Calls To Calendar
SMS To CSV
SMS To Gmail
Voicemail To Gmail

Sites
How Long For Me
SaveMySerials

Blog
Twitter

NerdyHearn - Blog


<< Back To All Blogs

Javascript XMLHttp requests: Fixing the data necessary to complete this operation...

Thursday, June 12th, 2008

Javascript is no doubt annoying to say the least, albeit, very powerful and makes for a great user experience. Once again I have come across an issue that is not easily diagnosable and is only present in MSIE.

The error is: The data necessary to complete this operation is not yet available

This error is generally received after making asynchronous ajax calls in MSIE. The line that causes the error is when an asynchronous AJAX call returns responseText from the call itself. Because it is returning responseText, and the call is asynchronous, responseText is not yet populated (as this happens in the callback function with asynchronous calls). If you have an ajax class like I use, it always returns responseText, regardless of if the call was asynchronous or not (as my classes support but synchronous and asynchronous calls).

A quick fix for this if you do the same, is to do the following check before you return from the function, such as post() or get():

if (typeof(this.Request.responseText)=="unknown") {
return("");
} else {
return this.Request.responseText;
}

Hopefully this helps a few of you out, not doubt this has been driving me crazy for the past few months.

JS Tom Out.

Tags

JavaScript

Related Blogs


First Version of SharePoint Validator now available on CodePlex
JavaScript Classes: A quick rundown
Using Ext JS in SharePoint... a tip
What causes "Please wait while scripts are loaded..." in SharePoint

Comments

zeki said on Friday, March 5th, 2010 @ 3:28 AM

pdprint problem

kunjan said on Friday, March 6th, 2009 @ 3:49 AM

Thanks this is solve my problem

Mark said on Wednesday, August 13th, 2008 @ 9:36 AM

Another solution is to wait till request.readyState is 4 before using request.responseText.

Wezzul said on Thursday, July 10th, 2008 @ 9:55 AM

Wow, this is what I was looking for. I don't know if this is a *good* way to do things, but it does seem to get rid of the error that IE6 raises. Good show.

WEZ

Add A Comment

Name:


URL:


Email Address: (not public, used to send notifications on further comments)


Comments:



Enter the text above, except for the 1st and last character:


NerdyHearn - Latest tech news relating to C#, ASP.NET, SharePoint, PHP, general development, and more. SaveMySerials - Protect yourself from theft, fire, natural disasters and more by recording your serial numbers