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


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",

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.


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.