Jump to content

pass more paramatersusing ajax


vikaspa

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.