Thursday, August 02, 2007

Unknown runtime error in Ajax

Unknown runtime error in Ajax

This error messages can come when you use browser(IE).

This error occurs when you are manipulating the html of a div with javascript using the innerHTML method.

The workaround for this error is
1) create another div,
2) put the html inside it and
3) Append it to the original div.

Here is sample code:

var originalDiv= document.getElementById('myDiv');

var tempDiv = document.createElement('tempDiv');
tempDiv .innerHTML =html;



swamy said...

hi ritesh

i tried ur solution

my code was

document.getElementById('screenInfo').innerHTML = xmlhttp.responseText;

and as suggested by u

i replaced it by
var origianldiv = document.getElementById('screenInfo');
var tempdiv = document.createElement('tempDiv');
tempdiv.innerHTML= xmlhttp.responseText;

where screenInfo is a id of aspan tag where i need to replace the inner html but am still facing the same error plz suggest a work around since my delivery is affected

Anonymous said...

good solution
thank you very much brother

ghasem said...

Thanks, You Are The Best...
Solved My Problem...