Jump to content

Head scratcher....


solon

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/195540-head-scratcher/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.