Javascript AJAX error in IE-unknown runtime error

Javascript AJAX causes unknown runtime error in IE javascript debugger for IE 7.x and 8.x.

I have this code that works perfectly in firefox but IE 7.x and 8.x has a problem:

function revDescr(condition_id, rev_cat_id) {
    this.condition_id = condition_id;
    this.rev_cat_id = rev_cat_id;
    
    //update the reverse entry description
    xmlhttp10=GetXmlHttpObject(); //if xmlhttp object not created
    if (xmlhttp10==null) {
        alert ("Browser does not support HTTP Request");
        return;
    }

    var url="./include_ajax/updateRevDescrSi.php";
    url=url+"?condition_id="+this.condition_id;
    url=url+"&rev_cat_id="+this.rev_cat_id;
    url=url+"&sid="+Math.random();
    xmlhttp10.open("GET",url,true);
    xmlhttp10.onreadystatechange=stateChangedRevDescr;

    xmlhttp10.send(null);
}

function stateChangedRevDescr() {
    if (xmlhttp10.readyState==4) {
        var data = xmlhttp10.responseText;
        document.getElementById("reverse_content").innerHTML = data;
    } else  {
        document.getElementById("reverse_content").innerHTML = "Please wait...updating";
    }
}

“unknown runtime error” on this line:

document.getElementById("reverse_content").innerHTML = data;

var data is passed as:

"

OTC

Melasma condition. OTC description.

"

If I change that one line above to this:

document.getElementById("reverse_content").innerHTML = 'test';

it works. Or if I change it so var data returns ‘return test’ then it works. I found out that simply adding ANY html tag in the var data to something like:

'

test

'

causes this error.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Share

1 comment to Javascript AJAX error in IE-unknown runtime error

You must be logged in to post a comment.