views:

27

answers:

2

Hi everyone,

I have a table which has the information of a category, say a product. I have listed them in a dropdown menu. Now, what I need to do is, list the sub category of the selected category in a next dropdown menu. I hope, javascript is required, but I am not that familiar with javascript yet.

Would be much thankful for the help.

+1  A: 

You should use the AJAX.

With jQuery it is very simple:
$('#select1').change(function(){
$.ajax({
   //Send to php script category id. This script returns all subcategoties
   $.ajax({
      type: "POST",
      url: location.href,
      data: data,
      success : function (data)
      {   
         // Your return categories in data
         // Append list options to select2
      } 
});
});
Alexander.Plutov