What causes error in ie7?

misteryus

New Member
I am using this JS code to reach a list of cities. It works in fireworks, chrome .e.t.c. But in ie7 it does not. the line \[code\]document.getElementById(oDiv).innerHTML=xmlhttp.responseText;\[/code\] causes the error. When I change "responseText" to "readyState", "statusText", "readyState" the scripts works. Only "responseText" causes problem.What is the problem here?\[code\]function showAjax(oDiv, countrycode, dowhat) { if (oDiv == "") { document.getElementById(oDiv).innerHTML = ""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open('POST', 'ajax.php?dowhat=' + dowhat + '&countrycode=' + countrycode, true); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById(oDiv).innerHTML = xmlhttp.responseText; //document.getElementById(oDiv).innerHTML=xmlhttp.readyState; } } xmlhttp.send();}\[/code\]\[code\]<a href='http://stackoverflow.com/questions/15611284/#' onclick="showAjax('citytd','$countrycode','listcities')">Click</a>\[/code\]\[code\]<div id=citytd></div>\[/code\]
 
Back
Top