Possible Duplicate:
script not working in Ajax returned value
I am using ajax for fetching some data.There is a link "Show items of this user".while cliking on it it will call a function 'callfunc' with parameter 'userid'.This ajax function will go to getdetails.php and and will fetch some details of that corresponding user.
<tr><td colspan="6" align="right"><a href="javascript:callfunc(<?= $row5[user_id]; ?>)" style="font-size:10px;">Show items of this user</a></td></tr>
<script type="text/javascript">
function callfunc(str)
{
//alert(str);
if (str.length==0)
{
document.getElementById("result").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.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("result").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getdetails.php?cid="+str,true);
xmlhttp.send();
}
getdetails.php
<?php
require 'include/connect.php';
$cid=$_GET['cid'];
$sql="select * from table where status='Active' and user_id=$cid";
$res=mysql_query($sql);
$tot=mysql_num_rows($res);
if($tot>0){
while($row=mysql_fetch_array($res))
{
echo '<tr class="detail9txt" height="30">
<td width="2%"><input type="checkbox" name="item" id="item" value="'.$row[item_id].'"></td>
<td align="center" width="12%" style="vertical-align:baseline;">
<a href="detail.php?item_id='.$row[item_id].'" id="link3">'.$row['title'].'</a>
</td>
<td align="center" width="17%" style="vertical-align:baseline;">
'.substr($row['des'], 0, 20).'
</td></tr>';
}
?>
This code is working properly in mozilla,chrome,and opera.But not working in IE.While clicking on the link "Show Items of this user" nothing happens in IE.Any idea?