I am using this code: <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(function(){ $('#country').change(function(){ $.getJSON('dropdown.php',{cmd:'states',country:$('#country').val ()},function(data){ $.each(data,function(index,val){ var option = new Option(val,val); $('#state').add(option); }); }); }); }); </script>
This is basically cascading drop down, upon selecting country states will be shown, but this line $('#state').add(option); is not adding value to the select box "state" also how the select box "state" will be empties via jquery.