show a second dropdown based on previous dropdown selection in php

Solutions on MaxInterview for show a second dropdown based on previous dropdown selection in php by the best coders in the world

showing results for - "show a second dropdown based on previous dropdown selection in php"
Carl
27 May 2017
1<script src="https://code.jquery.com/jquery-2.1.1.min.js"
2    type="text/javascript"></script>
3<script>
4function getState() {
5        var str='';
6        var val=document.getElementById('country-list');
7        for (i=0;i< val.length;i++) { 
8            if(val[i].selected){
9                str += val[i].value + ','; 
10            }
11        }         
12        var str=str.slice(0,str.length -1);
13        
14	$.ajax({          
15        	type: "GET",
16        	url: "get_state.php",
17        	data:'country_id='+str,
18        	success: function(data){
19        		$("#state-list").html(data);
20        	}
21	});
22}
23</script>