vikaspa Posted September 5, 2010 Share Posted September 5, 2010 Dear All I need your Help I am passing 2 parameters using ajax1.requestFile = 'devices.php?parentid='+cat+"&&brand=$brand"; but the last parameter is not passed / sent to devices.php as a result the drop down is not populated / filled up with appropiate data I even tried ajax1.requestFile = 'devices.php?parentid='+cat+"&&brand=399"; (Pass a fixed value ) Complete function that passes value to a program : function getsub2List(sel) { var cat = sel.options[sel.selectedIndex].value; document.getElementById('sub2').options.length = 0; // Empty city select box if(cat.length>0){ ajax1.requestFile = 'devices.php?parentid='+cat+"&&brand=399"; // Specifying which file to get ajax1.onCompletion = createsubcat1; // Specify function that will be executed after file has been found ajax1.runAJAX(); // Execute AJAX function } } function createsubcat1() { var obj = document.getElementById('sub2'); eval(ajax1.response); // Executing the response from Ajax as Javascript code obj.focus(); } >>>> devices.php <<<<< complet ecode <?php function parent_cat_list($prodtype, $brand , $clause){ include("includes/dbconnect.php"); mysql_select_db($database_DBconnect, $DBconnect); $query=sprintf("SELECT * FROM product WHERE status=1 and producttype=%s and brand=%s order by name",$prodtype, $brand ); $Result = mysql_query($query, $DBconnect) or die(mysql_error()); $rows = mysql_fetch_assoc($Result); $totalrows=mysql_num_rows($Result); $options="obj.options[obj.options.length] = new Option('Anything...','');\n"; if($totalrows>0){ do{ $options.="obj.options[obj.options.length] = new Option('". $rows['name'] ."','".$rows['pid']."');\n"; }while($rows = mysql_fetch_assoc($Result)); } return $options; } if(isset($_REQUEST['parentid'])){ $prodtype=$_REQUEST['parentid']; $brand=$_REQUEST['brand'];?> <?php echo parent_cat_list($prodtype,$brand, ''); } ?> [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/212576-pass-more-paramatersusing-ajax/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.