Dear All,
Below is part of my codes. The problem here is that when the results is generated from the php and send via ajax is not being shown in my page. But in Firefox it can be seen only thing the combo box goes up. But in IE nothing is shown. I want the combo box to be below the Master combo box. IS this part wrong to push the data in <tr> <div id="cbTrailerList"></div></tr> ? I would like to actually build dynamic row below the existing rows is that possible?
<tr>
<td>
<label class=description for=element_1>Master <font color="red">*</font></label>
</td>
<td>
<?php
echo "<select class='select' id='masterID' name='masterID'> ";
$link = mysql_connect(dbHost, dbUser, dbPassword);
if(!$link)
{
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(dbDatabase);
$query = "SELECT tblMaster.masterID,tblMaster.masterSerialNumber FROM tblMaster Where tblMaster.masterStatus='a' And tblMaster.clientID=".$_SESSION['clientID']." ORDER BY tblMaster.masterSerialNumber";
$result = mysql_query($query);
echo "<option value=0>-Select Master-</option>";
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if($masterID==$row['masterID'])
{
echo "<option selected value=".$row['masterID'].">".$row['masterSerialNumber']."</option>";
}
else
{
echo "<option value=".$row['masterID'].">".$row['masterSerialNumber']."</option>";
}
}
echo "</select>";
mysql_close($link);
?>
</td>
</tr>
<tr>
<td><p class=error id="vehicleIDError" ></p></td>
<td></td>
</tr>
<tr>
<div id="cbTrailerList"></div>
</tr>
Ajax calling the php
function getTrailer()
{
alert("getTrailer");
differentiator=Math.floor(Math.random()*50000);
//if (str=="")
// {
// document.getElementById("cbTrailerList").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)
{
alert("Test : "+xmlhttp.responseText);
document.getElementById("cbTrailerList").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getTrailerList.php?d="+differentiator,true);
xmlhttp.send();
}
Php generating the combo box
echo "<td>";
echo "<label class=description for=element_1>Vehicle <font color='red'>*</font></label>";
echo "</td>";
echo "<td>";
echo "<select class='select' id='trailerID' name='trailerID' >";
echo "<option value=0>-Select Trailer-</option>";
if($n1>0)
{
while($row1 = mysql_fetch_array($result1, MYSQL_ASSOC))
{
echo "<option value=".$row1['trailerID'].">".$row1['trailerRegistrationNumber']."</option>";
}
}
echo "</select>";
echo "</td>";