0

Hi,

I m populating 2 select boxes country & city dynamically using ajax. All is working fine in mozilla &all but not in IE. but when i change country acc. to it city select box doesn't get populated in IE.

<td width="60%" align="right">Country : <?=PopulateSelect('country1',"SELECT * FROM tblname order by cname",1,"Country");?> City : <?=PopulateSelect('city1',"select cityid,cityname from city where countryid=1 order by cityname",0);?></td>

Any help in this matter will be highly appreciated.
Thanks in advance

2
Contributors
6
Replies
8
Views
5 Years
Discussion Span
Last Post by vn412
0

I see absolutely no JavaScript in the example above. Can you please show the code that is causing you issues. Also please show the error that you are getting.

0

I getting blank selectbox in IE. Error is
"UnKnown runtime error" in js file
Here is js file code

function Ajax_init() {
this.GetData= function (val,id,p,load)
{
	var ctrl=null;
	var d=new Date();
	var timestamp=d.getMinutes()+'_'+d.getSeconds()+'_'+d.getMilliseconds();
var xmlHttp=GetXmlHttpObject()

	if(p==null)
		p=1;
	if(load==null)
		load=1;	


if (xmlHttp==null)

  {

  alert ("Browser does not support HTTP Request")

  return

  } 
ctrl=document.getElementById(id);
if(load==1)
	ctrl.innerHTML="<img src='images/loading.gif' />";
xmlHttp.onreadystatechange=function() { HandleGetData(id,xmlHttp);  }
xmlHttp.open("GET", 'AjaxPage.php?q='+val+'&page='+p+'&order='+document.getElementById('hdnorder').value+'&timestamp='+timestamp, true)
xmlHttp.send(null);
}
}

function HandleGetData(div,xmlHttp)
{ 
	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

 { 
	  //  ctrl.innerHTML=xmlHttp.responseText;
	// alert(xmlHttp.responseText);
	  document.getElementById(div).innerHTML=xmlHttp.responseText
		//LoadWindow();
 } 

}


function HandleGetData()
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

 { 
	
	    ctrl.innerHTML=xmlHttp.responseText;
		LoadWindow();
 } 

}

function GetXmlHttpObject()
{

var xmlHttp=null;

try

 {

 // Firefox, Opera 8.0+, Safari

 xmlHttp=new XMLHttpRequest();

 }

catch (e)

 {

 // Internet Explorer

 try

  {

  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

  }

 catch (e)

  {

  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

 }

return xmlHttp;

}

on line

document.getElementById(div).innerHTML=xmlHttp.responseText

but everything is working fine all browsers except IE.

Thanks

0

In any of the IE versions its not working but currently i m testing in IE8.

Thanks

0

What is the values for the following:

alert(document.getElementById(div));
alert(document.getElementById(div).innerHTML);
alert(xmlHttp.responseText);

Edited by stbuchok: n/a

0

The output is
for:
alert(document.getElementById(div));
[objectHTMLDivElement]
for
alert(document.getElementById(div).innerHTML);
<img src='images/loading.gif' />

for:
alert(xmlHttp.responseText);
<select name="city" id="city1">
<option value="0">Toronto</option>
<option value="1">Athabasca</option>
</select>

When i m printing alert it gives me the select code in alert box, but in page "blank selectbox".

Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.