solon Posted March 17, 2010 Share Posted March 17, 2010 Hey guys, I need some help cause i am really confused here... I have two AJAX functions (jQuery) the same structure(exact same structure) in two different files. I am using AJAX with PHP. when i use the one it works in all browsers(IE, Firefox, Chrome). The second AJAX function works only in Firefox. This is the first Function with the .php file that calls : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> function ins(x) { $('#show').load('temp1.php',{ pr : x }); } </script> The temp1.php file: <?php include ("db.php"); $pr = $_POST["pr"]; $get_p = mysql_query("query") or die (mysql_error()); $gp = mysql_fetch_array($get_p); $qry = mysql_query("query2") or die(mysql_error()); $ch = mysql_query("query3") or die (mysql_error()); $x=0; while($ch1 = mysql_fetch_array($ch)) { $pr = $ch1[1]; $id = $ch1[0]; $x +=1; echo "<table cellspacing='2' width='350' bgcolor='#333333' border='0' > <tr> <td colspan = '2'>$pr</td> <input type='hidden' id='$x' value='$id'/> <td>"; ?> <input type='button' value='X' class='remove' onclick='rem_one(document.getElementById("<?php echo $x; ?>").value)' /></td></tr> <?php } ?> Now the second function with the .php file that works only in Firefox: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script type="text/javascript"> function show_cat(x) { $('#cat').load('get_cat.php',{ s_id : x }); } </script> <select name="section"> <option value="Select">Select Section</option> <?php $chs = mysql_query("query") or die (mysql_error()); while($chs1 = mysql_fetch_array($chs)) { echo '<option onclick="show_cat('.$chs1[0].')" value="'.$chs1[0].'">'.$chs1[1].'</option>'; } ?> </select> The get_cat.php file: <option value="Select">Select Cat</option> <?php include("db.php"); if(isset($_POST['s_id'])) { $s_id = $_POST['s_id']; $chc = mysql_query("query1") or die (mysql_error()); while($chc1 = mysql_fetch_array($chc)) { echo '<option onclick="show_br('.$chc1[0].')" value="'.$chc1[0].'">'.$chc1[1].'</option>'; } } else { echo '<option value="Select">Error</option>'; } ?> Thanks for any help Solon Quote Link to comment Share on other sites More sharing options...
solon Posted March 17, 2010 Author Share Posted March 17, 2010 Guys i found the solution... Sorry for taking your time.. The problem was when i was calling the function from <option onclick="function(x)"></option> instead of <select onchange="function(x)"></select> Quote Link to comment Share on other sites More sharing options...
isedeasy Posted March 19, 2010 Share Posted March 19, 2010 Seeing as you are already using Jquery, why not trigger the events unobtrusively? Quote Link to comment Share on other sites More sharing options...
solon Posted March 19, 2010 Author Share Posted March 19, 2010 could you explain that a bit more please isedeasy? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.