0

Hi all, i'm blocked on a script php/ajax that manage dynamic select.
To let me understand better here the link tutorial:

http://phpgon.com/ajax-php-dynamic-select-lists.html

I take this little code part aboutthe file dynamic-lists.js where i'd like to pass another variable to the get-subcategories.php page and not only the variable idcategory.

function dyl_get_subcategories()
{
 var idcategory = document.getElementById("c").value;
 var response = ajax_call_server( "get-subcategories.php",
                                  "?c="+idcategory);
 eval(response);
}

To notice that function dyl_get_subcategories() is called when there is a change on a form (example.php) ...when you select the first "select"to populate the second. I need to make pass other info.

The point is that i'm not experienced with javascript. In this js file I need to pass a php variable and I don't know how to do :-s

Thanks all.

Shella

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by noelthefish
0

do you mean you have to pass more information in the function dyl_get_subcategories() ? if so then all you have to do is change the onchange="dyl_get_subcategories();" to onchange="dyl_get_subcategories('<php $var ?>');"

Change the Javascript function to

function dyl_get_subcategories(myvar)

Then you can access it within the function by calling myvar.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.