I just loop my Ajax call until the 12030 error goes away. The error is reported as a bug here
Does anyone know if there is a better fix…as this takes up time to loop. I read this was a known issue with IE that it intermittently produces 12030 errors as that Ajax status.
var Ajax = {
createAjaxObject: function()
{
var request;
try
{
request = new XMLHttpRequest();
}
catch(error)
{
try
{
request = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(error)
{
try
{
request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(error)
{
request = false;
}
}
}
return request;
},
useAjaxObject: function( path, param, ajax_func, html_div )
{
var object = new Ajax.createAjaxObject();
object.open( "POST", path, true );
object.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
object.setRequestHeader( "Content-length", param.length );
object.setRequestHeader( "Connection", "close" );
object.onreadystatechange = function()
{
if( this.readyState === 4 )
{
if( this.status === 200 )
{
ajax_func( this.responseText, html_div );
}
else
{
Ajax.repeatUseAjaxObject( path, param, ajax_func, html_div );
return false;
}
}
};
object.send( param );
return true;
},
repeatUseAjaxObject: function( path, param, ajax_func, html_div )
{
var state = false,
count = 1;
while(state === false && count <= 5)
{
state = Ajax.useAjaxObject( path, param, ajax_func, html_div );
if( count !== 1 )
{
alert( 'Ajax Object Use Failed ');
}
count++;
}
return state;
}
I have this same problem, and I found a solution that works for me as long as the AJAX request is asynchronous.
The solution is to wrap the AJAX call in a
setTimeoutcall with a delay of 0.This seems to work 100% of the time for me.
I also verified with one of my co-workers that the 12030 error still occurs in Internet Explorer 9, as well.
<rant>So Billy G and company see fit to provide us with the new "Metro" interface, but they can't be bothered to fix their browser that all web programmers must support</rant>