fareedreg Posted January 16, 2010 Share Posted January 16, 2010 I m working on library managment system ... i m getting value from database using ajax on bookid basis. my code is working perfectly in ie6 and above ... but not getting result on firefox and opera latest version... WHY? code php <select name="cmbsuppid" id="cmbissueid" onchange="showSupplier(this.value);"> <?php include('connect.php'); $Tb = "booksupp_master"; mysql_select_db($Db, $link); $query = "select supp_id from $Tb order by supp_id"; $result= mysql_query($query,$link); $fel=mysql_num_fields($result); $nro=mysql_num_rows($result); if ($nro>0) { echo "<option>-- Select Supplier --</option>\n"; while ($row=mysql_fetch_array($result)) { echo "<option value='$row[supp_id]'>$row[supp_id]</option>\n"; } } mysql_close($link); ?> </select> </tr> <tr> <td>Supplier Name </td> <td> <div name="txtSupp" id="txtSupp"><b></b></div> </td> </tr> ajax var xmlhttp; function showBook(str) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="getbookname.php"; url=url+"?q="+str; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChangedbook; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChangedbook() { if (xmlhttp.readyState==4) { document.getElementById("txtbook").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } getbookname.php <?php session_start(); $q=$_GET["q"]; include ('connect.php'); mysql_select_db($Db, $link); $query="select * from book_master where book_id=$q"; $result= mysql_query($query,$link) or die(""); $fel=mysql_num_fields($result); $nro=mysql_num_rows($result); if($nro>0) { $row=mysql_fetch_array($result); echo "<td>" . $row['book_name'] . "</td>"; echo " "; echo " "; echo " "; echo " "; echo "Book Price : "; $bookprice=$row['cost']; echo "<td>" . $row['cost'] ."</td>"; echo " "; echo " "; echo " "; echo " "; echo "Status : "; $status = $row['avail']; if ($status==0) { echo "<td>" . "Book Available" . "</td>"; } if ($status==1) { echo "<td>" . "Book is Not Available" . "</td>"; } } ////Param percentage $query="select issuecharges,noofdays from param"; $result= mysql_query($query,$link) or die(""); $fel=mysql_num_fields($result); $nro=mysql_num_rows($result); if($nro>0) { $row=mysql_fetch_array($result); $perval=$row['issuecharges']; } $cal = $bookprice/100*$perval; $_SESSION['charge'] = $cal; echo "<br>"; echo "<td height='21'>Issue Charges :<b> $cal </b></td>"; echo " "; echo " "; echo "<b>rupees<b>"; mysql_close($link); ?> Link to comment https://forums.phpfreaks.com/topic/188715-ajax-not-supporting-firefox-and-mozilla/ Share on other sites More sharing options...
ukndoit2 Posted January 21, 2010 Share Posted January 21, 2010 Try this: In your javascript code: window.onload = initPage; function initPage() { document.getElementById("cmbissueid").onBlur = showSupplier(document.getElementById("cmbissueid").value); } Then remove: onchange="showSupplier(this.value);" from the html code Hope that helps, Richard Link to comment https://forums.phpfreaks.com/topic/188715-ajax-not-supporting-firefox-and-mozilla/#findComment-999292 Share on other sites More sharing options...
iScript Posted January 25, 2010 Share Posted January 25, 2010 Does the browser give you an alertbox? Link to comment https://forums.phpfreaks.com/topic/188715-ajax-not-supporting-firefox-and-mozilla/#findComment-1001211 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.